diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2012-08-23 07:41:58 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-08-30 20:31:55 -0400 |
commit | b707c65865e74b5cd98c66cb67fda8543248cb3b (patch) | |
tree | a021c829d46f8589f2a21924661127bb19adaded /drivers/dma | |
parent | 983d7beb7de4ba7c715ea62e982c9fe54fa554a1 (diff) |
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: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 000d309602b2..826d0d5d5b0b 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -2920,19 +2920,23 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
2920 | struct d40_base *base = NULL; | 2920 | struct d40_base *base = NULL; |
2921 | int num_log_chans = 0; | 2921 | int num_log_chans = 0; |
2922 | int num_phy_chans; | 2922 | int num_phy_chans; |
2923 | int clk_ret = -EINVAL; | ||
2923 | int i; | 2924 | int i; |
2924 | u32 pid; | 2925 | u32 pid; |
2925 | u32 cid; | 2926 | u32 cid; |
2926 | u8 rev; | 2927 | u8 rev; |
2927 | 2928 | ||
2928 | clk = clk_get(&pdev->dev, NULL); | 2929 | clk = clk_get(&pdev->dev, NULL); |
2929 | |||
2930 | if (IS_ERR(clk)) { | 2930 | if (IS_ERR(clk)) { |
2931 | d40_err(&pdev->dev, "No matching clock found\n"); | 2931 | d40_err(&pdev->dev, "No matching clock found\n"); |
2932 | goto failure; | 2932 | goto failure; |
2933 | } | 2933 | } |
2934 | 2934 | ||
2935 | clk_enable(clk); | 2935 | clk_ret = clk_prepare_enable(clk); |
2936 | if (clk_ret) { | ||
2937 | d40_err(&pdev->dev, "Failed to prepare/enable clock\n"); | ||
2938 | goto failure; | ||
2939 | } | ||
2936 | 2940 | ||
2937 | /* Get IO for DMAC base address */ | 2941 | /* Get IO for DMAC base address */ |
2938 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base"); | 2942 | 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 | return base; | 3066 | return base; |
3063 | 3067 | ||
3064 | failure: | 3068 | failure: |
3065 | if (!IS_ERR(clk)) { | 3069 | if (!clk_ret) |
3066 | clk_disable(clk); | 3070 | clk_disable_unprepare(clk); |
3071 | if (!IS_ERR(clk)) | ||
3067 | clk_put(clk); | 3072 | clk_put(clk); |
3068 | } | ||
3069 | if (virtbase) | 3073 | if (virtbase) |
3070 | iounmap(virtbase); | 3074 | iounmap(virtbase); |
3071 | if (res) | 3075 | if (res) |