From patchwork Mon Nov 30 11:24:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7723201 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A3F599F387 for ; Mon, 30 Nov 2015 11:25:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAA9F204E0 for ; Mon, 30 Nov 2015 11:24:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBF3B204D3 for ; Mon, 30 Nov 2015 11:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbbK3LY6 (ORCPT ); Mon, 30 Nov 2015 06:24:58 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:59499 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbbK3LY5 (ORCPT ); Mon, 30 Nov 2015 06:24:57 -0500 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0Lar3w-1ajGsr3aXo-00kQZp; Mon, 30 Nov 2015 12:24:26 +0100 From: Arnd Bergmann To: Lee Jones Cc: Michael Hennerich , Jingoo Han , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] backlight: adp8860: fix another uninitialized variable use Date: Mon, 30 Nov 2015 12:24:23 +0100 Message-ID: <3284846.T0rzz6n1As@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:2qTx6FxZ4BB5+ozma+eAMq+4iLOIhlF/XvssWMoxmURoC5B/n1F ZNlON0EcIhAeYpt8LeSEETrlDCqzG1oS6kalwjdge7gTk8XFKGyYD6piWWHtaDuUY3Z9TfT pEPjsjz2d2nxCTgPJ79mC3MEavnQN8Fk9x5H90E0xyVCYEnhNiIhfjJEb0uTUM7w1zIDO2q ZMtPgPIFKnNX+Q0+VypjQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:UakRoK4NzFg=:Jj5VI9xdsBXxKe1GdD7dY3 Nl5sgjlUVd836vOD/cgQAJR+XNibRuJciWwT3wq4LE3lnzlBib4tskM09kXAuWRZWGPklAo2R ONCjuwxgbAFpfEzsftqEzpsBgqBQ/6WaUiLZb2oODmsd3GUDtmOTpAKQjjAkhtQTl5bIJF2wE azmYRt0tRkwKpqaq7JYifBcbIJ1uYenqHLjyOe04GFhwDWlOvEMzqeAxJwjVmUjklCdwh2fBj bBEwXAbmVYWsAZptQUeEO8dZCExNnc1c9qkHTwbXAQ2PW5rtpARjj2PN1f0P5+LLSKj82QdX3 UxSv3RSap5U5YySLWS3/+0c85rYMjSpGjsx+TSrEVkoJmJtTpzp3jiGlib/HqJDRKHpMirz9B FaQOUMdiLmolSWxyA8M/5lvug68ulRtPzv4EIz0zsiiqyrp38+qex5GB5VGqkvnPTsFs9xAdR fL55D/xeHBJuhrLVHGhICUMMLnGucXszJ1kbPvuM06oeJiKuz7FcH0jYr/uls9i0KzIT6ZjRQ up+kDuHAcZlVv1WUIJkkrUpr9yzgmF+7MINuHDOArxtTYjhjsdZ5D+fORSY6Q/2aU8MDK+s8F MRPp3PQt47QWRVreymPTp4/NnRQ+vpzwGYY4z+9pnoFV3lIcPpSyOUd9b8xy9jSvYFEncDjpp 2BwW35gQFECwuQxnDCHUkWF9ne0DL3pHifk9knmZ9fLp8mY5RAYBKcCUUL11TGAz4YyzZHpWm HWbxH6xLy06UHUOt Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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") Acked-by: Michael Hennerich Acked-by: Jingoo Han --- Sorry for missing this third hunk the first time around. -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 */