Commit fca82646 authored by Richard Weinberger's avatar Richard Weinberger Committed by Anatolij Gustschin

powerpc: 512x: Fix mpc5121_clk_get()

If try_module_get() fails, mpc5121_clk_get() might return
a wrong clock.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
parent 55d512e2
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment