summaryrefslogtreecommitdiff
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-06-22 00:49:54 +0300
committerThomas Gleixner <tglx@linutronix.de>2017-06-22 01:04:26 +0300
commitb7dcc4eacc45263ac5d3a0bd78c64e9ff7c94c13 (patch)
tree715095fb3cbc4e21d59acf6f6fcfafdf59369f23 /drivers/clocksource
parent17d9d6875ce89c0c98bb54d4d5649efb22986bf3 (diff)
downloadlinux-b7dcc4eacc45263ac5d3a0bd78c64e9ff7c94c13.tar.xz
clocksource/drivers: Fix uninitialized variable use in timer_of_init
If none of the flags are set, 'ret' is uninitialized as pointed out by gcc: drivers/clocksource/timer-of.c: In function 'timer_of_init': drivers/clocksource/timer-of.c:160:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] Since calling the function without any of the flags is an error, set the return value to -EINVAL for that case. [ tglx: Get rid of the silly backwards goto while at it ] Fixes: dc11bae78529 ("clocksource/drivers: Add timer-of common init routine") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Link: http://lkml.kernel.org/r/20170621215005.3870011-1-arnd@arndb.de
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/timer-of.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index be1dbee11c20..64b1c2081a67 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -130,7 +130,7 @@ static __init int timer_base_init(struct device_node *np,
int __init timer_of_init(struct device_node *np, struct timer_of *to)
{
- int ret;
+ int ret = -EINVAL;
int flags = 0;
if (to->flags & TIMER_OF_BASE) {
@@ -156,7 +156,6 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
if (!to->clkevt.name)
to->clkevt.name = np->name;
-out:
return ret;
out_fail:
@@ -168,5 +167,5 @@ out_fail:
if (flags & TIMER_OF_BASE)
timer_base_exit(&to->of_base);
- goto out;
+ return ret;
}