dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: sf-pdma: Simplify the error handling path in 'sf_pdma_probe()'
@ 2020-05-01 10:08 Christophe JAILLET
  2020-05-13 11:37 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-05-01 10:08 UTC (permalink / raw)
  To: green.wan, dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
 drivers/dma/sf-pdma/sf-pdma.c | 25 +++++++------------------
 1 file 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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: sf-pdma: Simplify the error handling path in 'sf_pdma_probe()'
  2020-05-01 10:08 [PATCH] dmaengine: sf-pdma: Simplify the error handling path in 'sf_pdma_probe()' Christophe JAILLET
@ 2020-05-13 11:37 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-05-13 11:37 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: green.wan, dan.j.williams, dmaengine, linux-kernel, kernel-janitors

On 01-05-20, 12:08, Christophe JAILLET wrote:
> There is no need to explicitly free memory that have been 'devm_kzalloc'ed.
> Simplify the probe function accordingly.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-13 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 10:08 [PATCH] dmaengine: sf-pdma: Simplify the error handling path in 'sf_pdma_probe()' Christophe JAILLET
2020-05-13 11:37 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).