aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2012-03-26 05:01:29 -0400
committerAnatolij Gustschin <agust@denx.de>2012-09-09 15:36:05 -0400
commitfca826460e55d4e8f2deceb09f22f9340a0db24c (patch)
tree2aa62e9769f1677f366737c5429f70b4f7294f57
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>
-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);
54static struct clk *mpc5121_clk_get(struct device *dev, const char *id) 54static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
55{ 55{
56 struct clk *p, *clk = ERR_PTR(-ENOENT); 56 struct clk *p, *clk = ERR_PTR(-ENOENT);
57 int dev_match = 0; 57 int dev_match;
58 int id_match = 0; 58 int id_match;
59 59
60 if (dev == NULL || id == NULL) 60 if (dev == NULL || id == NULL)
61 return clk; 61 return clk;
62 62
63 mutex_lock(&clocks_mutex); 63 mutex_lock(&clocks_mutex);
64 list_for_each_entry(p, &clocks, node) { 64 list_for_each_entry(p, &clocks, node) {
65 dev_match = id_match = 0;
66
65 if (dev == p->dev) 67 if (dev == p->dev)
66 dev_match++; 68 dev_match++;
67 if (strcmp(id, p->name) == 0) 69 if (strcmp(id, p->name) == 0)