backlight: adp8860: Fix another uninitialized variable use
authorArnd Bergmann <arnd@arndb.de>
Mon, 30 Nov 2015 11:24:23 +0000 (12:24 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Jan 2016 07:58:43 +0000 (07:58 +0000)
A recent patch I did fixed two potential uses of uninitialized
variables in the adp8870 and adp8860 drivers. Unfortunately,
I missed another one:

drivers/video/backlight/adp8860_bl.c: In function 'adp8860_bl_ambient_light_level_show':
drivers/video/backlight/adp8860_bl.c:570:11: warning: 'reg_val' may be used uninitialized in this function

This does the same change as before in one additional function,
and also changes the check for the return value in a way that
avoids another false positive warning with a similar message.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 6be3a5a9cd91 ("backlight: adp88x0: Fix uninitialized variable use")
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jingoo Han <jingoohan1@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/adp8860_bl.c

index f0d4c0324580a4e6781680b91bd9e71889cba93d..510e559c060e597c5407bddb79a67f49cb4efaee 100644 (file)
@@ -566,11 +566,13 @@ static ssize_t adp8860_bl_ambient_light_level_show(struct device *dev,
 
        mutex_lock(&data->lock);
        error = adp8860_read(data->client, ADP8860_PH1LEVL, &reg_val);
-       ret_val = reg_val;
-       error |= adp8860_read(data->client, ADP8860_PH1LEVH, &reg_val);
+       if (!error) {
+               ret_val = reg_val;
+               error = adp8860_read(data->client, ADP8860_PH1LEVH, &reg_val);
+       }
        mutex_unlock(&data->lock);
 
-       if (error < 0)
+       if (error)
                return error;
 
        /* Return 13-bit conversion value for the first light sensor */
This page took 0.043761 seconds and 5 git commands to generate.