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

dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function

In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone
by some 'fsl_dma_chan_remove()', as already done in the remove function.

It was added in the remove function in commit 77cd62e8082b ("fsldma: allow
Freescale Elo DMA driver to be compiled as a module")

Fixes: d3f620b2c4fe ("fsldma: simplify IRQ probing and handling")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201212160614.92576-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Christophe JAILLET and committed by
Vinod Koul
b202d4e8 cbc0ad00

+5
+5
drivers/dma/fsldma.c
··· 1214 1214 { 1215 1215 struct fsldma_device *fdev; 1216 1216 struct device_node *child; 1217 + unsigned int i; 1217 1218 int err; 1218 1219 1219 1220 fdev = kzalloc(sizeof(*fdev), GFP_KERNEL); ··· 1293 1292 return 0; 1294 1293 1295 1294 out_free_fdev: 1295 + for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) { 1296 + if (fdev->chan[i]) 1297 + fsl_dma_chan_remove(fdev->chan[i]); 1298 + } 1296 1299 irq_dispose_mapping(fdev->irq); 1297 1300 iounmap(fdev->regs); 1298 1301 out_free: