Commit f2b5d503 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Vinod Koul

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tested-by: default avatarGreen Wan <green.wan@sifive.com>
Reviewed-by: default avatarGreen Wan <green.wan@sifive.com>
Link: https://lore.kernel.org/r/20200501100824.126534-1-christophe.jaillet@wanadoo.frSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent d24224de
...@@ -506,11 +506,11 @@ static int sf_pdma_probe(struct platform_device *pdev) ...@@ -506,11 +506,11 @@ static int sf_pdma_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pdma->membase = devm_ioremap_resource(&pdev->dev, res); pdma->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdma->membase)) if (IS_ERR(pdma->membase))
goto ERR_MEMBASE; return PTR_ERR(pdma->membase);
ret = sf_pdma_irq_init(pdev, pdma); ret = sf_pdma_irq_init(pdev, pdma);
if (ret) if (ret)
goto ERR_INITIRQ; return ret;
sf_pdma_setup_chans(pdma); sf_pdma_setup_chans(pdma);
...@@ -544,24 +544,13 @@ static int sf_pdma_probe(struct platform_device *pdev) ...@@ -544,24 +544,13 @@ static int sf_pdma_probe(struct platform_device *pdev)
"Failed to set DMA mask. Fall back to default.\n"); "Failed to set DMA mask. Fall back to default.\n");
ret = dma_async_device_register(&pdma->dma_dev); ret = dma_async_device_register(&pdma->dma_dev);
if (ret) if (ret) {
goto ERR_REG_DMADEVICE; dev_err(&pdev->dev,
"Can't register SiFive Platform DMA. (%d)\n", ret);
return ret;
}
return 0; 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) static int sf_pdma_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment