Skip to content

Commit f2b5d50

Browse files
tititiou36vinodkoul
authored andcommitted
dmaengine: sf-pdma: Simplify the error handling path in 'sf_pdma_probe()'
There is no need to explicitly free memory that have been 'devm_kzalloc'ed. Simplify the probe function accordingly. Signed-off-by: Christophe JAILLET <[email protected]> Tested-by: Green Wan <[email protected]> Reviewed-by: Green Wan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent d24224d commit f2b5d50

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

drivers/dma/sf-pdma/sf-pdma.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,11 @@ static int sf_pdma_probe(struct platform_device *pdev)
506506
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
507507
pdma->membase = devm_ioremap_resource(&pdev->dev, res);
508508
if (IS_ERR(pdma->membase))
509-
goto ERR_MEMBASE;
509+
return PTR_ERR(pdma->membase);
510510

511511
ret = sf_pdma_irq_init(pdev, pdma);
512512
if (ret)
513-
goto ERR_INITIRQ;
513+
return ret;
514514

515515
sf_pdma_setup_chans(pdma);
516516

@@ -544,24 +544,13 @@ static int sf_pdma_probe(struct platform_device *pdev)
544544
"Failed to set DMA mask. Fall back to default.\n");
545545

546546
ret = dma_async_device_register(&pdma->dma_dev);
547-
if (ret)
548-
goto ERR_REG_DMADEVICE;
547+
if (ret) {
548+
dev_err(&pdev->dev,
549+
"Can't register SiFive Platform DMA. (%d)\n", ret);
550+
return ret;
551+
}
549552

550553
return 0;
551-
552-
ERR_MEMBASE:
553-
devm_kfree(&pdev->dev, pdma);
554-
return PTR_ERR(pdma->membase);
555-
556-
ERR_INITIRQ:
557-
devm_kfree(&pdev->dev, pdma);
558-
return ret;
559-
560-
ERR_REG_DMADEVICE:
561-
devm_kfree(&pdev->dev, pdma);
562-
dev_err(&pdev->dev,
563-
"Can't register SiFive Platform DMA. (%d)\n", ret);
564-
return ret;
565554
}
566555

567556
static int sf_pdma_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)