summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/512x
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2012-03-26 09:01:29 +0000
committerAnatolij Gustschin <agust@denx.de>2012-09-09 21:36:05 +0200
commitfca826460e55d4e8f2deceb09f22f9340a0db24c (patch)
tree2aa62e9769f1677f366737c5429f70b4f7294f57 /arch/powerpc/platforms/512x
parent55d512e245bc7699a8800e23df1a24195dd08217 (diff)
powerpc: 512x: Fix mpc5121_clk_get()
If try_module_get() fails, mpc5121_clk_get() might return a wrong clock. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'arch/powerpc/platforms/512x')
-rw-r--r--arch/powerpc/platforms/512x/clock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 1d8700ff60b..9f771e05457 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -54,14 +54,16 @@ static DEFINE_MUTEX(clocks_mutex);
static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
{
struct clk *p, *clk = ERR_PTR(-ENOENT);
- int dev_match = 0;
- int id_match = 0;
+ int dev_match;
+ int id_match;
if (dev == NULL || id == NULL)
return clk;
mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) {
+ dev_match = id_match = 0;
+
if (dev == p->dev)
dev_match++;
if (strcmp(id, p->name) == 0)