From: Arnd Bergmann <arnd@arndb.de>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: [PATCH] clocksource/drivers: fix uninitialized variable use in timer_of_init
Date: Wed, 21 Jun 2017 23:49:54 +0200 [thread overview]
Message-ID: <20170621215005.3870011-1-arnd@arndb.de> (raw)
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.
Fixes: dc11bae78529 ("clocksource/drivers: Add timer-of common init routine")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/clocksource/timer-of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index be1dbee11c20..af75cbdcfc06 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) {
--
2.9.0
next reply other threads:[~2017-06-21 21:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 21:49 Arnd Bergmann [this message]
2017-06-21 22:06 ` [tip:timers/core] clocksource/drivers: Fix " tip-bot for Arnd Bergmann
2017-06-22 7:07 ` [PATCH] clocksource/drivers: fix " Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170621215005.3870011-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®