]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
clocksource/drivers/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()'
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Fri, 23 Jun 2017 19:55:10 +0000 (21:55 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 27 Jun 2017 09:25:40 +0000 (11:25 +0200)
'clk' is a valid pointer at this point. So calling PTR_ERR on it is
pointess.

Return the error code from 'clk_prepare_enable()' if it fails instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/mips-gic-timer.c

index e31e0832602497654a7768647401315152622cbe..17b861ea2626cb2d20320deae6db4818107fd71b 100644 (file)
@@ -167,10 +167,11 @@ static int __init gic_clocksource_of_init(struct device_node *node)
 
        clk = of_clk_get(node, 0);
        if (!IS_ERR(clk)) {
-               if (clk_prepare_enable(clk) < 0) {
+               ret = clk_prepare_enable(clk);
+               if (ret < 0) {
                        pr_err("GIC failed to enable clock\n");
                        clk_put(clk);
-                       return PTR_ERR(clk);
+                       return ret;
                }
 
                gic_frequency = clk_get_rate(clk);