From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932297AbcAKH5q (ORCPT ); Mon, 11 Jan 2016 02:57:46 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37379 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932104AbcAKH5o (ORCPT ); Mon, 11 Jan 2016 02:57:44 -0500 Date: Mon, 11 Jan 2016 07:57:40 +0000 From: Lee Jones To: Arnd Bergmann Cc: Michael Hennerich , Jingoo Han , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] backlight: adp8860: fix another uninitialized variable use Message-ID: <20160111075740.GP3331@x1> References: <3284846.T0rzz6n1As@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3284846.T0rzz6n1As@wuerfel> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Nov 2015, 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 > Fixes: 6be3a5a9cd91 ("backlight: adp88x0: Fix uninitialized variable use") > --- > Sorry for missing this third hunk the first time around. Where's your diff? Applied anyway, thanks. > 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 */ > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog