Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: milbeaut-xdmac: Fix a resource leak in the error handling path of the probe function

'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>
Link: https://lore.kernel.org/r/20201219132800.183254-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Christophe JAILLET and committed by
Vinod Koul
d645148c 33cbd54d

+3 -1
+3 -1
drivers/dma/milbeaut-xdmac.c
··· 350 350 351 351 ret = dma_async_device_register(ddev); 352 352 if (ret) 353 - return ret; 353 + goto disable_xdmac; 354 354 355 355 ret = of_dma_controller_register(dev->of_node, 356 356 of_dma_simple_xlate, mdev); ··· 363 363 364 364 unregister_dmac: 365 365 dma_async_device_unregister(ddev); 366 + disable_xdmac: 367 + disable_xdmac(mdev); 366 368 return ret; 367 369 } 368 370