Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Richard Weinberger and committed by
Anatolij Gustschin
fca82646 55d512e2

+4 -2
+4 -2
arch/powerpc/platforms/512x/clock.c
··· 54 54 static struct clk *mpc5121_clk_get(struct device *dev, const char *id) 55 55 { 56 56 struct clk *p, *clk = ERR_PTR(-ENOENT); 57 - int dev_match = 0; 58 - int id_match = 0; 57 + int dev_match; 58 + int id_match; 59 59 60 60 if (dev == NULL || id == NULL) 61 61 return clk; 62 62 63 63 mutex_lock(&clocks_mutex); 64 64 list_for_each_entry(p, &clocks, node) { 65 + dev_match = id_match = 0; 66 + 65 67 if (dev == p->dev) 66 68 dev_match++; 67 69 if (strcmp(id, p->name) == 0)