diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2012-01-26 06:08:41 -0500 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-10-26 21:06:13 +0100 |
commit | c60ce91cc52e53619bb919ad5ff8891b75c2a4dd (patch) | |
tree | 1a14a1fc73c46ffc54e0b961591dcdcecc007f4a /drivers/hwmon | |
parent | 47fa3c9b8352d4f403118b01f8a97fff1353c30b (diff) | |
download | lwn-c60ce91cc52e53619bb919ad5ff8891b75c2a4dd.tar.gz lwn-c60ce91cc52e53619bb919ad5ff8891b75c2a4dd.zip |
hwmon: (applesmc) Silence uninitialized warnings
commit 0fc86eca1b338d06ec500b34ef7def79c32b602b upstream.
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>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | 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 6218d08066ea..30cac58422b7 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 |