Skip to contentSkip to conversation

dmaengine: axi-dmac: add a check for devm_regmap_init_mmio

PATCH Applied Chuhong Yuan 3 participants 3 messages Dec 9, 2019 – Dec 11, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: axi-dmac: add a check for devm_regmap_init_mmio

The driver misses checking the result of devm_regmap_init_mmio(). Add a check to fix it.

Fixes fc15be39a827 ("dmaengine: axi-dmac: add regmap support")
---
 drivers/dma/dma-axi-dmac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +9 -1
index a0ee404b736e..cf4f892562cc 100644
@@ -830,6 +830,7 @@ static int axi_dmac_probe(struct platform_device *pdev)
 	struct dma_device *dma_dev;
 	struct axi_dmac *dmac;
 	struct resource *res;
+	struct regmap *regmap;
 	int ret;
 
 	dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
@@ -921,10 +922,17 @@ static int axi_dmac_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dmac);
 
-	devm_regmap_init_mmio(&pdev->dev, dmac->base, &axi_dmac_regmap_config);
+	regmap = devm_regmap_init_mmio(&pdev->dev, dmac->base,
+		 &axi_dmac_regmap_config);
+	if (IS_ERR(regmap)) {
+		ret = PTR_ERR(regmap);
+		goto err_free_irq;
+	}
 
 	return 0;
 
+err_free_irq:
+	free_irq(dmac->irq, dmac);
 err_unregister_of:
 	of_dma_controller_free(pdev->dev.of_node);
 err_unregister_device:
Signature · 1 line
2.24.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Chuhong Yuan

[External]

The driver misses checking the result of devm_regmap_init_mmio(). Add a check to fix it.

Thanks :)

Quoted 41 lines
Fixes fc15be39a827 ("dmaengine: axi-dmac: add regmap support")
---
 drivers/dma/dma-axi-dmac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/dma-axi-dmac.c +1 -0
index a0ee404b736e..cf4f892562cc 100644
@@ -830,6 +830,7 @@ static int axi_dmac_probe(struct platform_device
 *pdev)
 	struct dma_device *dma_dev;
 	struct axi_dmac *dmac;
 	struct resource *res;
+	struct regmap *regmap;
 	int ret;
 
drivers/dma/dma-axi-dmac.c +8 -1
 	dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
@@ -921,10 +922,17 @@ static int axi_dmac_probe(struct platform_device
 *pdev)
 
 	platform_set_drvdata(pdev, dmac);
 
-	devm_regmap_init_mmio(&pdev->dev, dmac->base,
 &axi_dmac_regmap_config);
+	regmap = devm_regmap_init_mmio(&pdev->dev, dmac->base,
+		 &axi_dmac_regmap_config);
+	if (IS_ERR(regmap)) {
+		ret = PTR_ERR(regmap);
+		goto err_free_irq;
+	}
 
 	return 0;
 
+err_free_irq:
+	free_irq(dmac->irq, dmac);
 err_unregister_of:

of_dma_controller_free(pdev->dev.of_node);
err_unregister_device:

maintainer Applied
#2 lore raw
In reply to Chuhong Yuan
Quoted 2 lines · Chuhong Yuan

The driver misses checking the result of devm_regmap_init_mmio(). Add a check to fix it.

Applied, thanks

Signature · 1 line
~Vinod