diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2020-05-01 12:08:24 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-05-13 17:07:50 +0530 |
commit | f2b5d503c04a28828af8e41fcd4a5d9fd978a78e (patch) | |
tree | f3cde762bd5ac0cfd65f4cb057ee2dee3454c622 /drivers/dma/sf-pdma | |
parent | d24224dea57108f96d13579f20206c339bb8e52f (diff) |
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 <christophe.jaillet@wanadoo.fr>
Tested-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Green Wan <green.wan@sifive.com>
Link: https://lore.kernel.org/r/20200501100824.126534-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/sf-pdma')
-rw-r--r-- | drivers/dma/sf-pdma/sf-pdma.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index 6d0bec947636..5c118c7e02bd 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -506,11 +506,11 @@ static int sf_pdma_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdma->membase = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(pdma->membase)) - goto ERR_MEMBASE; + return PTR_ERR(pdma->membase); ret = sf_pdma_irq_init(pdev, pdma); if (ret) - goto ERR_INITIRQ; + return ret; sf_pdma_setup_chans(pdma); @@ -544,24 +544,13 @@ static int sf_pdma_probe(struct platform_device *pdev) "Failed to set DMA mask. Fall back to default.\n"); ret = dma_async_device_register(&pdma->dma_dev); - if (ret) - goto ERR_REG_DMADEVICE; + if (ret) { + dev_err(&pdev->dev, + "Can't register SiFive Platform DMA. (%d)\n", ret); + return ret; + } return 0; - -ERR_MEMBASE: - devm_kfree(&pdev->dev, pdma); - return PTR_ERR(pdma->membase); - -ERR_INITIRQ: - devm_kfree(&pdev->dev, pdma); - return ret; - -ERR_REG_DMADEVICE: - devm_kfree(&pdev->dev, pdma); - dev_err(&pdev->dev, - "Can't register SiFive Platform DMA. (%d)\n", ret); - return ret; } static int sf_pdma_remove(struct platform_device *pdev) |