From: Christophe JAILLET Date: Sat, 19 Dec 2020 13:28:00 +0000 (+0100) Subject: dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the... X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~428^2~35 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=41f95d84fcf58fcbdeaffb28bcec290cecf1608e;p=linux.git dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function commit d645148cc82ca7fbacaa601414a552184e9c6dd3 upstream. '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 Link: https://lore.kernel.org/r/20201219132800.183254-1-christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/dma/milbeaut-xdmac.c b/drivers/dma/milbeaut-xdmac.c index 85a597228fb0..748b260bbc97 100644 --- a/drivers/dma/milbeaut-xdmac.c +++ b/drivers/dma/milbeaut-xdmac.c @@ -351,7 +351,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); @@ -364,6 +364,8 @@ static int milbeaut_xdmac_probe(struct platform_device *pdev) unregister_dmac: dma_async_device_unregister(ddev); +disable_xdmac: + disable_xdmac(mdev); return ret; }