Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932963AbcLHV6V (ORCPT ); Thu, 8 Dec 2016 16:58:21 -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 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1240 Lines: 37 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(-) 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; } -- 2.9.0