Commit a26b0d49 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Vineet Gupta

clocksource: nps: avoid maybe-uninitialized warning

We get a harmless false-positive warning with the newly added nps
clocksource driver:

drivers/clocksource/timer-nps.c: In function 'nps_setup_clocksource':
drivers/clocksource/timer-nps.c:102:6: error: 'nps_timer1_freq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Gcc here fails to identify that IS_ERR() is only true if PTR_ERR()
has a nonzero value. Using PTR_ERR_OR_ZERO() to convert the result
first makes this obvious and shuts up the warning.

Fixes: 0ee4d9922df5 ("clocksource: Add clockevent support to NPS400 driver")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 60263dcd
...@@ -53,9 +53,10 @@ static int __init nps_get_timer_clk(struct device_node *node, ...@@ -53,9 +53,10 @@ static int __init nps_get_timer_clk(struct device_node *node,
int ret; int ret;
*clk = of_clk_get(node, 0); *clk = of_clk_get(node, 0);
if (IS_ERR(*clk)) { ret = PTR_ERR_OR_ZERO(*clk);
if (ret) {
pr_err("timer missing clk"); pr_err("timer missing clk");
return PTR_ERR(*clk); return ret;
} }
ret = clk_prepare_enable(*clk); ret = clk_prepare_enable(*clk);
......
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