Skip to content

Commit

Permalink
powerpc: 512x: Fix mpc5121_clk_get()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Weinberger authored and Anatolij Gustschin committed Sep 9, 2012
1 parent 55d512e commit fca8264
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/powerpc/platforms/512x/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fca8264

Please sign in to comment.