diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-11-22 09:33:44 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-11-30 14:54:25 -0500 |
commit | a26b0d4962c7daf91d942a917c71c20e164b687a (patch) | |
tree | a20bdb7696eac194d005226eae15fd505258d522 /drivers/clocksource/timer-nps.c | |
parent | 60263dcd821b9558ea08b112d9d31ffbe3ac643f (diff) |
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: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'drivers/clocksource/timer-nps.c')
-rw-r--r-- | drivers/clocksource/timer-nps.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/clocksource/timer-nps.c b/drivers/clocksource/timer-nps.c index b4c8a023a2d4..8da5e93b6810 100644 --- a/drivers/clocksource/timer-nps.c +++ b/drivers/clocksource/timer-nps.c | |||
@@ -53,9 +53,10 @@ static int __init nps_get_timer_clk(struct device_node *node, | |||
53 | int ret; | 53 | int ret; |
54 | 54 | ||
55 | *clk = of_clk_get(node, 0); | 55 | *clk = of_clk_get(node, 0); |
56 | if (IS_ERR(*clk)) { | 56 | ret = PTR_ERR_OR_ZERO(*clk); |
57 | if (ret) { | ||
57 | pr_err("timer missing clk"); | 58 | pr_err("timer missing clk"); |
58 | return PTR_ERR(*clk); | 59 | return ret; |
59 | } | 60 | } |
60 | 61 | ||
61 | ret = clk_prepare_enable(*clk); | 62 | ret = clk_prepare_enable(*clk); |