Commit 5298816f authored by Arvind Yadav's avatar Arvind Yadav Committed by Stefan Bader

dmaengine: imx-sdma: Handle return value of clk_prepare_enable

BugLink: http://bugs.launchpad.net/bugs/1765010

[ Upstream commit fb9caf37 ]

clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 04f71130
...@@ -1722,17 +1722,24 @@ static int sdma_probe(struct platform_device *pdev) ...@@ -1722,17 +1722,24 @@ static int sdma_probe(struct platform_device *pdev)
if (IS_ERR(sdma->clk_ahb)) if (IS_ERR(sdma->clk_ahb))
return PTR_ERR(sdma->clk_ahb); return PTR_ERR(sdma->clk_ahb);
clk_prepare(sdma->clk_ipg); ret = clk_prepare(sdma->clk_ipg);
clk_prepare(sdma->clk_ahb); if (ret)
return ret;
ret = clk_prepare(sdma->clk_ahb);
if (ret)
goto err_clk;
ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0, "sdma", ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0, "sdma",
sdma); sdma);
if (ret) if (ret)
return ret; goto err_irq;
sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL); sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL);
if (!sdma->script_addrs) if (!sdma->script_addrs) {
return -ENOMEM; ret = -ENOMEM;
goto err_irq;
}
/* initially no scripts available */ /* initially no scripts available */
saddr_arr = (s32 *)sdma->script_addrs; saddr_arr = (s32 *)sdma->script_addrs;
...@@ -1847,6 +1854,10 @@ static int sdma_probe(struct platform_device *pdev) ...@@ -1847,6 +1854,10 @@ static int sdma_probe(struct platform_device *pdev)
dma_async_device_unregister(&sdma->dma_device); dma_async_device_unregister(&sdma->dma_device);
err_init: err_init:
kfree(sdma->script_addrs); kfree(sdma->script_addrs);
err_irq:
clk_unprepare(sdma->clk_ahb);
err_clk:
clk_unprepare(sdma->clk_ipg);
return ret; return ret;
} }
...@@ -1857,6 +1868,8 @@ static int sdma_remove(struct platform_device *pdev) ...@@ -1857,6 +1868,8 @@ static int sdma_remove(struct platform_device *pdev)
dma_async_device_unregister(&sdma->dma_device); dma_async_device_unregister(&sdma->dma_device);
kfree(sdma->script_addrs); kfree(sdma->script_addrs);
clk_unprepare(sdma->clk_ahb);
clk_unprepare(sdma->clk_ipg);
/* Kill the tasklet */ /* Kill the tasklet */
for (i = 0; i < MAX_DMA_CHANNELS; i++) { for (i = 0; i < MAX_DMA_CHANNELS; i++) {
struct sdma_channel *sdmac = &sdma->channel[i]; struct sdma_channel *sdmac = &sdma->channel[i];
......
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