From patchwork Thu Dec 8 21:57:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101429 Delivered-To: patch@linaro.org Received: by 10.140.21.20 with SMTP id 20csp6560qgk; Thu, 8 Dec 2016 13:58:45 -0800 (PST) X-Received: by 10.99.204.81 with SMTP id q17mr136066606pgi.168.1481234325727; Thu, 08 Dec 2016 13:58:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l21si30436568pli.179.2016.12.08.13.58.45; Thu, 08 Dec 2016 13:58:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932947AbcLHV6U (ORCPT + 5 others); Thu, 8 Dec 2016 16:58:20 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:49826 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932898AbcLHV6S (ORCPT ); Thu, 8 Dec 2016 16:58:18 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0Mg7K1-1c2dov15YD-00NRoq; Thu, 08 Dec 2016 22:58:12 +0100 From: Arnd Bergmann To: Iyappan Subramanian , Keyur Chudgar Cc: Arnd Bergmann , "David S. Miller" , Quan Nguyen , Khuong Dinh , Toan Le , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/3] net: xgene: avoid bogus maybe-uninitialized warning Date: Thu, 8 Dec 2016 22:57:05 +0100 Message-Id: <20161208215727.44841-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161208215727.44841-1-arnd@arndb.de> References: <20161208215727.44841-1-arnd@arndb.de> X-Provags-ID: V03:K0:BByPPEiUzV5wNW0IGDcbCaMoTfre8oWa0sp0P4SxvxO4zrzDy+a JBhDkqvTNy+T8zDjXBeN6jy1goiRYh0Pkww5YxaM4tlsK6fTUp+S5Egf6O30+FaYEciV6Kn MUrKmX0C6+VpHWCnoFB07bes1+/VBuEB9Io+eI4jLYEGeB0N7CG7wGWi7cuB0dQ/ojgvvlT iHsDupa0tWD+6Y3fpBR8A== X-UI-Out-Filterresults: notjunk:1; V01:K0:hh5VdcE9LpU=:C1Z/p1OwtA7wsbXJBxBzgA W+m2xW3Rm6uGb+It024yl61enAjMMQ1ArNYgkmwjB8al+NzRSAGpnVm6j/wobyiKJupfs/WTz LArNmBXNPq35Qxzyo9WalQo4IUQtkwc8pT63rWRoxMkn0z+4DFhVqpJ8PUhT0fkQ2ER0v8zE9 dBwKD2cHpp+knAXbtg86REKL12yjP89el4b9l9DlRhAUzpoo9avkxYjVct2NnzzqrUffgb0un rFdnpI1Cdp9WF3Dk3ZsoE8pHu03V9HDs4LAhnIJ6tCs8y9sbTwWOR/xR3ihX7LtL9/Rv5qFDQ i6uBbMyEA8ghCsSR0beK1RCLae2RboknLp7kNgk0cRwOREdeMd5IamxdFkD8Jc6RzH0FpVpwB PNr171NH8Au2mLRcRy6XDe07UuIFNToJ3AKawEuHNgJZz5jWMysWGXcSIys2gSJx/RqM5DaG3 INmOgroPKDXMYb7VU8WS83ucDvTEvw/rX2tDoxfIIdIpuTseVLJ/YtzPmCEmnNuy0rVv+4pBu Ko37fdWEXZC55m6Z/46euq03uCnhC5V2Q0hGRmzrkvtCwKpilsJc5/ZohkUSmnEzlvcObE3tJ KpoDc412I1XrNgbabE8zwvuRoNLXmKrsuzUIfoa5EUUYHxEMEc8/4HuI7SG1iD7OqG/jNL94d ydTkTN7dahH0Gf6uJqohjqLtBpnHfOTnAe/z9Ye+GwXmsOAGXnag+nDYgn7IVRqZldng= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In some configurations, gcc cannot trace the state of variables across a spin_unlock() barrier, leading to a warning about correct code: xgene_enet_main.c: In function 'xgene_enet_start_xmit': ../../../phy/mdio-xgene.h:112:14: error: 'mss_index' may be used uninitialized in this function [-Werror=maybe-uninitialized] Here we can trivially move the assignment before that spin_unlock, which reliably avoids the warning. Fixes: e3978673f514 ("drivers: net: xgene: Fix MSS programming") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 6c7eea8b36af..dba4b883e9a3 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -319,11 +319,11 @@ static int xgene_enet_setup_mss(struct net_device *ndev, u32 mss) } } - spin_unlock(&pdata->mss_lock); - /* No slots with ref_count = 0 available, return busy */ if (!mss_index_found) - return -EBUSY; + mss_index = -EBUSY; + + spin_unlock(&pdata->mss_lock); return mss_index; }