]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hwmon: (applesmc) Silence uninitialized warnings
authorHenrik Rydberg <rydberg@euromail.se>
Thu, 26 Jan 2012 11:08:41 +0000 (06:08 -0500)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Mon, 19 Mar 2012 01:27:41 +0000 (18:27 -0700)
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>
drivers/hwmon/applesmc.c

index 1b130852e3e109db2e7f5ab640d349ef27ddaba4..f082e48ab11395e3f99545d3feea2b3def29d32a 100644 (file)
@@ -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