]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
arm: bcm235xx: clk_set_rate avoid possible NULL deref
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>
Sun, 30 Jul 2017 18:22:47 +0000 (20:22 +0200)
committerTom Rini <trini@konsulko.com>
Sun, 13 Aug 2017 19:17:27 +0000 (15:17 -0400)
It does not make sense first to dereference c and then
to check if it is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
arch/arm/cpu/armv7/bcm235xx/clk-core.c

index ee4b34574a0dc2436d6a0c69ffe3058ca07d2da4..89e367be822797e1f55d6dae0e1eaa721ec78de2 100644 (file)
@@ -493,9 +493,9 @@ int clk_set_rate(struct clk *c, unsigned long rate)
 {
        int ret;
 
-       debug("%s: %s rate=%ld\n", __func__, c->name, rate);
        if (!c || !c->ops || !c->ops->set_rate)
                return -EINVAL;
+       debug("%s: %s rate=%ld\n", __func__, c->name, rate);
 
        if (c->use_cnt)
                return -EINVAL;