Commit b707c658 authored by Ulf Hansson's avatar Ulf Hansson Committed by Vinod Koul

dma/ste_dma40: Fixup clock usage during probe

Fixup some errorhandling for clocks during probe and make sure
to use clk_prepare as well as clk_enable.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent 983d7beb
...@@ -2920,19 +2920,23 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) ...@@ -2920,19 +2920,23 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
struct d40_base *base = NULL; struct d40_base *base = NULL;
int num_log_chans = 0; int num_log_chans = 0;
int num_phy_chans; int num_phy_chans;
int clk_ret = -EINVAL;
int i; int i;
u32 pid; u32 pid;
u32 cid; u32 cid;
u8 rev; u8 rev;
clk = clk_get(&pdev->dev, NULL); clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
d40_err(&pdev->dev, "No matching clock found\n"); d40_err(&pdev->dev, "No matching clock found\n");
goto failure; goto failure;
} }
clk_enable(clk); clk_ret = clk_prepare_enable(clk);
if (clk_ret) {
d40_err(&pdev->dev, "Failed to prepare/enable clock\n");
goto failure;
}
/* Get IO for DMAC base address */ /* Get IO for DMAC base address */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base");
...@@ -3062,10 +3066,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) ...@@ -3062,10 +3066,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
return base; return base;
failure: failure:
if (!IS_ERR(clk)) { if (!clk_ret)
clk_disable(clk); clk_disable_unprepare(clk);
if (!IS_ERR(clk))
clk_put(clk); clk_put(clk);
}
if (virtbase) if (virtbase)
iounmap(virtbase); iounmap(virtbase);
if (res) if (res)
......
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