Commit fce9a74b authored by Fabio Estevam's avatar Fabio Estevam Committed by Vinod Koul

dmaengine: imx-dma: Check for clk_prepare_enable() error

clk_prepare_enable() may fail, so we should better check its return value
and propagate it in the case of error.

While at it, change the label 'err' to a more descriptive naming.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent d264b486
...@@ -1083,8 +1083,12 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1083,8 +1083,12 @@ static int __init imxdma_probe(struct platform_device *pdev)
if (IS_ERR(imxdma->dma_ahb)) if (IS_ERR(imxdma->dma_ahb))
return PTR_ERR(imxdma->dma_ahb); return PTR_ERR(imxdma->dma_ahb);
clk_prepare_enable(imxdma->dma_ipg); ret = clk_prepare_enable(imxdma->dma_ipg);
clk_prepare_enable(imxdma->dma_ahb); if (ret)
return ret;
ret = clk_prepare_enable(imxdma->dma_ahb);
if (ret)
goto disable_dma_ipg_clk;
/* reset DMA module */ /* reset DMA module */
imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR); imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
...@@ -1094,20 +1098,20 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1094,20 +1098,20 @@ static int __init imxdma_probe(struct platform_device *pdev)
dma_irq_handler, 0, "DMA", imxdma); dma_irq_handler, 0, "DMA", imxdma);
if (ret) { if (ret) {
dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
goto err; goto disable_dma_ahb_clk;
} }
irq_err = platform_get_irq(pdev, 1); irq_err = platform_get_irq(pdev, 1);
if (irq_err < 0) { if (irq_err < 0) {
ret = irq_err; ret = irq_err;
goto err; goto disable_dma_ahb_clk;
} }
ret = devm_request_irq(&pdev->dev, irq_err, ret = devm_request_irq(&pdev->dev, irq_err,
imxdma_err_handler, 0, "DMA", imxdma); imxdma_err_handler, 0, "DMA", imxdma);
if (ret) { if (ret) {
dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
goto err; goto disable_dma_ahb_clk;
} }
} }
...@@ -1144,7 +1148,7 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1144,7 +1148,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
dev_warn(imxdma->dev, "Can't register IRQ %d " dev_warn(imxdma->dev, "Can't register IRQ %d "
"for DMA channel %d\n", "for DMA channel %d\n",
irq + i, i); irq + i, i);
goto err; goto disable_dma_ahb_clk;
} }
init_timer(&imxdmac->watchdog); init_timer(&imxdmac->watchdog);
imxdmac->watchdog.function = &imxdma_watchdog; imxdmac->watchdog.function = &imxdma_watchdog;
...@@ -1190,7 +1194,7 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1190,7 +1194,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
ret = dma_async_device_register(&imxdma->dma_device); ret = dma_async_device_register(&imxdma->dma_device);
if (ret) { if (ret) {
dev_err(&pdev->dev, "unable to register\n"); dev_err(&pdev->dev, "unable to register\n");
goto err; goto disable_dma_ahb_clk;
} }
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
...@@ -1206,9 +1210,10 @@ static int __init imxdma_probe(struct platform_device *pdev) ...@@ -1206,9 +1210,10 @@ static int __init imxdma_probe(struct platform_device *pdev)
err_of_dma_controller: err_of_dma_controller:
dma_async_device_unregister(&imxdma->dma_device); dma_async_device_unregister(&imxdma->dma_device);
err: disable_dma_ahb_clk:
clk_disable_unprepare(imxdma->dma_ipg);
clk_disable_unprepare(imxdma->dma_ahb); clk_disable_unprepare(imxdma->dma_ahb);
disable_dma_ipg_clk:
clk_disable_unprepare(imxdma->dma_ipg);
return ret; return ret;
} }
......
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