From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Henrik Rydberg <rydberg@euromail.se>
Cc: Jean Delvare <khali@linux-fr.org>,
"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] applesmc: Silence uninitialized warnings
Date: Thu, 26 Jan 2012 09:12:17 -0800 [thread overview]
Message-ID: <1327597937.2649.216.camel@groeck-laptop> (raw)
In-Reply-To: <1327576121-2073-1-git-send-email-rydberg@euromail.se>
On Thu, 2012-01-26 at 06:08 -0500, Henrik Rydberg wrote:
> Some error paths do not set a result, leading to the (false)
> assumption that the value may be used uninitialized. Set results for
> those paths as well.
>
> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
> ---
> drivers/hwmon/applesmc.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
> index b989553..11f79bb 100644
> --- a/drivers/hwmon/applesmc.c
> +++ b/drivers/hwmon/applesmc.c
> @@ -344,8 +344,10 @@ static int applesmc_get_lower_bound(unsigned int *lo, const char *key)
> while (begin != end) {
> int middle = begin + (end - begin) / 2;
> entry = applesmc_get_entry_by_index(middle);
> - if (IS_ERR(entry))
> + if (IS_ERR(entry)) {
> + *lo = 0;
> return PTR_ERR(entry);
> + }
> if (strcmp(entry->key, key) < 0)
> begin = middle + 1;
> else
> @@ -364,8 +366,10 @@ static int applesmc_get_upper_bound(unsigned int *hi, const char *key)
> while (begin != end) {
> int middle = begin + (end - begin) / 2;
> entry = applesmc_get_entry_by_index(middle);
> - if (IS_ERR(entry))
> + if (IS_ERR(entry)) {
> + *hi = smcreg.key_count;
> return PTR_ERR(entry);
> + }
> if (strcmp(key, entry->key) < 0)
> end = middle;
> else
That was an annoying warning .. I checked the code several times by now
to make sure it is not real. Good idea to fix it.
Applied to -next for now. Linus did not (yet) accept my last set of
patches, so I am not sure if it was too much cleanup for a release
candidate.
Guenter
next prev parent reply other threads:[~2012-01-26 17:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 11:08 Henrik Rydberg
2012-01-26 17:12 ` Guenter Roeck [this message]
2012-01-26 17:48 ` Henrik Rydberg
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=1327597937.2649.216.camel@groeck-laptop \
--to=guenter.roeck@ericsson.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=rydberg@euromail.se \
/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®