Skip to content

Commit

Permalink
clocksource/drivers/mips-gic-timer: Fix an error code in 'gic_clockso…
Browse files Browse the repository at this point in the history
…urce_of_init()'

'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>
  • Loading branch information
Christophe Jaillet authored and Daniel Lezcano committed Jun 27, 2017
1 parent b70957f commit 8c3ecd6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/clocksource/mips-gic-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8c3ecd6

Please sign in to comment.