Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754727AbbLVMpH (ORCPT ); Tue, 22 Dec 2015 07:45:07 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:35477 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754269AbbLVMpE (ORCPT ); Tue, 22 Dec 2015 07:45:04 -0500 From: "Jingoo Han" To: , "'Arnd Bergmann'" , "'Lee Jones'" Cc: , , , "'Jingoo Han'" References: <3284846.T0rzz6n1As@wuerfel> <565D6937.90503@analog.com> In-Reply-To: <565D6937.90503@analog.com> Subject: Re: [PATCH] backlight: adp8860: fix another uninitialized variable use Date: Tue, 22 Dec 2015 21:44:58 +0900 Message-ID: <000c01d13cb6$94e07ef0$bea17cd0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdEsHBheYgcSjHMDRrapM0njYyFHxQQmkyAA Content-Language: ko Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2379 Lines: 67 On Tuesday, December 01, 2015 6:33 PM, Michael Hennerich wrote: > On 11/30/2015 12:24 PM, Arnd Bergmann wrote: > > 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 > > Acked-by: Michael Hennerich Acked-by: Jingoo Han Best regards, Jingoo Han > > > Fixes: 6be3a5a9cd91 ("backlight: adp88x0: Fix uninitialized variable use") > > --- > > Sorry for missing this third hunk the first time around. > > > > diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c > > index f0d4c0324580..510e559c060e 100644 > > --- a/drivers/video/backlight/adp8860_bl.c > > +++ b/drivers/video/backlight/adp8860_bl.c > > @@ -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, ®_val); > > - ret_val = reg_val; > > - error |= adp8860_read(data->client, ADP8860_PH1LEVH, ®_val); > > + if (!error) { > > + ret_val = reg_val; > > + error = adp8860_read(data->client, ADP8860_PH1LEVH, ®_val); > > + } > > mutex_unlock(&data->lock); > > > > - if (error < 0) > > + if (error) > > return error; > > > > /* Return 13-bit conversion value for the first light sensor */ > > > > > -- > Greetings, > Michael > > -- > Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen > Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; > Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, > Margaret Seif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/