diff options
author | Richard Weinberger <richard@nod.at> | 2012-03-26 09:01:29 (GMT) |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2012-09-09 19:36:05 (GMT) |
commit | fca826460e55d4e8f2deceb09f22f9340a0db24c (patch) | |
tree | 2aa62e9769f1677f366737c5429f70b4f7294f57 | |
parent | 55d512e245bc7699a8800e23df1a24195dd08217 (diff) | |
download | linux-fca826460e55d4e8f2deceb09f22f9340a0db24c.tar.xz |
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>
-rw-r--r-- | arch/powerpc/platforms/512x/clock.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c index 1d8700f..9f771e0 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) |