dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function
@ 2020-12-19 13:28 Christophe JAILLET
  2020-12-21 14:26 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-12-19 13:28 UTC (permalink / raw)
  To: vkoul, dan.j.williams, jaswinder.singh
  Cc: dmaengine, linux-kernel, kernel-janitors, Christophe JAILLET

'disable_xdmac()' should be called in the error handling path of the
probe function to undo a previous 'enable_xdmac()' call, as already
done in the remove function.

Fixes: a6e9be055d47 ("dmaengine: milbeaut-xdmac: Add XDMAC driver for Milbeaut platforms")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Purely speculative
---
 drivers/dma/milbeaut-xdmac.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/milbeaut-xdmac.c b/drivers/dma/milbeaut-xdmac.c
index 584c931e807a..d29d01e730aa 100644
--- a/drivers/dma/milbeaut-xdmac.c
+++ b/drivers/dma/milbeaut-xdmac.c
@@ -350,7 +350,7 @@ static int milbeaut_xdmac_probe(struct platform_device *pdev)
 
 	ret = dma_async_device_register(ddev);
 	if (ret)
-		return ret;
+		goto disable_xdmac;
 
 	ret = of_dma_controller_register(dev->of_node,
 					 of_dma_simple_xlate, mdev);
@@ -363,6 +363,8 @@ static int milbeaut_xdmac_probe(struct platform_device *pdev)
 
 unregister_dmac:
 	dma_async_device_unregister(ddev);
+disable_xdmac:
+	disable_xdmac(mdev);
 	return ret;
 }
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function
  2020-12-19 13:28 [PATCH] dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function Christophe JAILLET
@ 2020-12-21 14:26 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-12-21 14:26 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dan.j.williams, jaswinder.singh, dmaengine, linux-kernel,
	kernel-janitors

On 19-12-20, 14:28, Christophe JAILLET wrote:
> 'disable_xdmac()' should be called in the error handling path of the
> probe function to undo a previous 'enable_xdmac()' call, as already
> done in the remove function.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-21 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19 13:28 [PATCH] dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function Christophe JAILLET
2020-12-21 14:26 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).