From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755139AbdKFXwu (ORCPT ); Mon, 6 Nov 2017 18:52:50 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51664 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771AbdKFXXf (ORCPT ); Mon, 6 Nov 2017 18:23:35 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jean Delvare" , "Guenter Roeck" Date: Mon, 06 Nov 2017 23:03:07 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 110/147] hwmon: (w83781d) Fix compile warning In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.95-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck commit bbc8a569ae91e0951f4b7f8eb33ef1970bf2129c upstream. The following compile warning may be seen if the driver is compiled with -Wuninitialized: drivers/hwmon/w83781d.c: warning: 'sc_addr[1]' may be used uninitialized in this function [-Wuninitialized] While this is a false positive, it is annoying in nightly builds, and may help to conceal real problems. The current code is quite tricky, and and it is easy to rearrage the code to make the warning disappear. So fix it. Cc: Jean Delvare Signed-off-by: Guenter Roeck Signed-off-by: Ben Hutchings --- drivers/hwmon/w83781d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -826,6 +826,7 @@ w83781d_detect_subclients(struct i2c_cli struct i2c_adapter *adapter = new_client->adapter; struct w83781d_data *data = i2c_get_clientdata(new_client); enum chips kind = data->type; + int num_sc = 1; id = i2c_adapter_id(adapter); @@ -850,6 +851,7 @@ w83781d_detect_subclients(struct i2c_cli } if (kind != w83783s) { + num_sc = 2; if (force_subclients[0] == id && force_subclients[1] == address) { sc_addr[1] = force_subclients[3]; @@ -865,7 +867,7 @@ w83781d_detect_subclients(struct i2c_cli } } - for (i = 0; i <= 1; i++) { + for (i = 0; i < num_sc; i++) { data->lm75[i] = i2c_new_dummy(adapter, sc_addr[i]); if (!data->lm75[i]) { dev_err(&new_client->dev, "Subclient %d " @@ -876,8 +878,6 @@ w83781d_detect_subclients(struct i2c_cli goto ERROR_SC_3; goto ERROR_SC_2; } - if (kind == w83783s) - break; } return 0;