mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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 commit77cd62e808
("fsldma: allow Freescale Elo DMA driver to be compiled as a module") Fixes:d3f620b2c4
("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>
This commit is contained in:
parent
cbc0ad004c
commit
b202d4e825
1 changed files with 5 additions and 0 deletions
|
@ -1214,6 +1214,7 @@ static int fsldma_of_probe(struct platform_device *op)
|
||||||
{
|
{
|
||||||
struct fsldma_device *fdev;
|
struct fsldma_device *fdev;
|
||||||
struct device_node *child;
|
struct device_node *child;
|
||||||
|
unsigned int i;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
fdev = kzalloc(sizeof(*fdev), GFP_KERNEL);
|
fdev = kzalloc(sizeof(*fdev), GFP_KERNEL);
|
||||||
|
@ -1292,6 +1293,10 @@ static int fsldma_of_probe(struct platform_device *op)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_free_fdev:
|
out_free_fdev:
|
||||||
|
for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) {
|
||||||
|
if (fdev->chan[i])
|
||||||
|
fsl_dma_chan_remove(fdev->chan[i]);
|
||||||
|
}
|
||||||
irq_dispose_mapping(fdev->irq);
|
irq_dispose_mapping(fdev->irq);
|
||||||
iounmap(fdev->regs);
|
iounmap(fdev->regs);
|
||||||
out_free:
|
out_free:
|
||||||
|
|
Loading…
Add table
Reference in a new issue