From patchwork Tue Feb 20 11:55:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 128892 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4560042ljc; Tue, 20 Feb 2018 04:04:06 -0800 (PST) X-Google-Smtp-Source: AH8x225WkSgODWNBuq7j5ENf4CaJdjgYFRzl+qoTrHA0gUylOvaZwsOnBaxOBCcbjmyg1xhj0n0Y X-Received: by 10.99.143.69 with SMTP id r5mr14792399pgn.160.1519128246267; Tue, 20 Feb 2018 04:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519128246; cv=none; d=google.com; s=arc-20160816; b=ex470Gx7R9tHjleA4ZcW9qa9uh7ihmY/HEkdj9gphPsGutE1CFBvH3kt0UtHoeiMN8 sq/Q5pwTAnssYtA9fvyA6HD+crBlt/m6NOBaDCnrTGkBEVjcw9BXHvFK/ipAU9hepCP3 voD+yPLSTbRqmH8UVeC1D60IPiO4qpa4gKuX9O6LNAR7Av11coc+dHn+18R0kQWY2ziI XOImvnB+nd9A3AZyNuAIt1nBflzyFUCOsTkypTimw40rd2WNZQmczWXc1vsqVnJZHtll Z4SUWER+9EKS27PRUCHqgcN3K2pr7n0VBAORWbVN6tabusMk35SOiI/9LdbTRu87i7UM OMpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0MTWQo4aYCDaWOFb6buoMRjDsfmt8Ienmk+DfaF9Ojk=; b=W+ig8EJE0HwTb5VtBi17u6HwtzuL92roVKgQAyzEbD85b9G/tHJSLwHryFB+BSzgv/ uYRbSDqvRtf6ChWvEkVHhkB04ryp7Rd2rJD3kGT199h2cmG2ZcSHXD1j2HEBMhyIwzdZ 2WOpGuVXS87Lkq9+JUglL6GY2l7lWTACpX2MHDB8MNslqPvdL+UeAa9s3PaL/wzCpbgK fsG0xnWn4lyt2B8w+V0uQD4WgdACLHkcOlOvvDEa7yxmYovqWGLwavHYr8jglcPxpFGK CgD3WTND8lMt7S+YUkQn+TrVga2yC4eX/bHlFPZQsjqd+HaXQLUjipHMcUcnALXY8nMM Kx7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si5675634plt.574.2018.02.20.04.04.05; Tue, 20 Feb 2018 04:04:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752101AbeBTMDq (ORCPT + 28 others); Tue, 20 Feb 2018 07:03:46 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:45065 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbeBTL7q (ORCPT ); Tue, 20 Feb 2018 06:59:46 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0LgGuK-1eRBtJ1yaK-00nhNB; Tue, 20 Feb 2018 12:59:41 +0100 From: Arnd Bergmann To: stable@vger.kernel.org Cc: Greg KH , linux-kernel@vger.kernel.org, Arnd Bergmann , Kalle Valo , Solomon Peachy , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [4.4-stable 17/22] cw1200: fix bogus maybe-uninitialized warning Date: Tue, 20 Feb 2018 12:55:04 +0100 Message-Id: <20180220115527.1806578-18-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180220115527.1806578-1-arnd@arndb.de> References: <20180220115527.1806578-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:wogxyrLAeoVmOE3r29gJQXizDF10TMsXKGkb7qgte9xWgNQXIXV ZItIABqs8fnFDcJFHz9ZL5lvgYzWsuL242Xzyz6XLPs6eWeQzOFc8VEj4HMsXtrpBjtiUyO ur4fKY0/dQvYDG/sucXdH1vhItknyUh3kGkInc7JXKsYGRqEQ2vldH+4foOz3Y/je2yqFDW 86BIGtC0UWsW1rU03iTQQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:vhbhmIYO6kA=:d0jNSAVvPX9pDsWukIZ82I yhlTLG0VwelRbFAxG34UmAPBdzJZD1op110upBwVOtIIzOl4kaXeYvIWfyj6bxktZ6fVx3yG0 QaHkGkjAabxrL/QxUSkrNyZr2QtOVXRH/vqVXugxjE5UTxsXAZcrklkl7hqTj/pQVPeuOMstq AiyEDoKq3cHnQ/l06iAX36j3/EsAeFw45GpnqWqPiWCBivaoZRtPha35jmHDgh6iOuSoUryWu H0200kx2APW6oBslrqn+iv3EHN7/Uz68YWEpAMyuYL9dauFnKT9Q+g/R7/YtiCawujTdq6g3G HjQsMA9gHiWG0rABIcip+b0hDp0jFiPYuedBjdE2bj+htifFPyadZ8ycs3bNZIk2lHjws1zxJ zfqRurrYJfe9TkJ/bklmzHzyFsbTWXwHDx+T/+hNLmDOyuDITQOZZIZZbTgla+S8jXow6O5hy hTgH6+oeGQTmyWA0qvv8Rgi7y8T74ZOw0xtG/AttGaEZraH/z07nvjE47LxAE4PdlKoh99F1U Cz+RqcH3xktzymXOUpd3TtjnbjKWMa7voQ3v56aRJPd/QxrV/vHTIi3ELHs4KEIgGELqpJr4n EqNwpiyriezswWaSbhcIsneGmWJIcLxv2LLK3SapIyOSROmwRO92rS3iU925GWq75SH/Lwn6r 2QpEo5RyVdboyrAdE38Sd2HjErwSkos/kMkJe4WJ4A2RIgRyGljRRBAFBhF79IAYAxPOdZbKT b+Adj6oToeNdJ8ypjWKm069fISYwL8YhZSoDW016dFF2dv9xU2E/blpIeTQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 7fc1503c906f0fac62d3506a6e993e49fb996248 upstream. On x86, the cw1200 driver produces a rather silly warning about the possible use of the 'ret' variable without an initialization presumably after being confused by the architecture specific definition of WARN_ON: drivers/net/wireless/st/cw1200/wsm.c: In function ‘wsm_handle_rx’: drivers/net/wireless/st/cw1200/wsm.c:1457:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] We have already checked that 'count' is larger than 0 here, so we know that 'ret' is initialized. Changing the 'for' loop into do/while also makes this clear to the compiler. Suggested-by: David Laight Signed-off-by: Arnd Bergmann Signed-off-by: Kalle Valo [arnd: rebased to 4.4] Signed-off-by: Arnd Bergmann --- drivers/net/wireless/cw1200/wsm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.9.0 diff --git a/drivers/net/wireless/cw1200/wsm.c b/drivers/net/wireless/cw1200/wsm.c index 9e0ca3048657..3dd46c78c1cc 100644 --- a/drivers/net/wireless/cw1200/wsm.c +++ b/drivers/net/wireless/cw1200/wsm.c @@ -379,7 +379,6 @@ static int wsm_multi_tx_confirm(struct cw1200_common *priv, { int ret; int count; - int i; count = WSM_GET32(buf); if (WARN_ON(count <= 0)) @@ -395,11 +394,10 @@ static int wsm_multi_tx_confirm(struct cw1200_common *priv, } cw1200_debug_txed_multi(priv, count); - for (i = 0; i < count; ++i) { + do { ret = wsm_tx_confirm(priv, buf, link_id); - if (ret) - return ret; - } + } while (!ret && --count); + return ret; underflow: