From patchwork Tue Aug 2 10:23:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101981 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp76741qga; Tue, 2 Aug 2016 03:24:48 -0700 (PDT) X-Received: by 10.98.34.151 with SMTP id p23mr105165663pfj.102.1470133488762; Tue, 02 Aug 2016 03:24:48 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ie9si175755pad.93.2016.08.02.03.24.48; Tue, 02 Aug 2016 03:24:48 -0700 (PDT) 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 S1753172AbcHBKYq (ORCPT + 4 others); Tue, 2 Aug 2016 06:24:46 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59447 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbcHBKYl (ORCPT ); Tue, 2 Aug 2016 06:24:41 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0LeM6H-1aub4P2jfh-00qAUY; Tue, 02 Aug 2016 12:23:52 +0200 From: Arnd Bergmann To: Iyappan Subramanian , Keyur Chudgar Cc: Arnd Bergmann , "David S. Miller" , Tanmay Inamdar , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: xgene: fix maybe-uninitialized variable Date: Tue, 2 Aug 2016 12:23:29 +0200 Message-Id: <20160802102348.81986-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X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ing-List: netdev@vger.kernel.org Building with -Wmaybe-uninitialized shows a potential use of an uninitialized variable: drivers/net/ethernet/apm/xgene/xgene_enet_hw.c: In function 'xgene_enet_phy_connect': drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:802:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized] Although the compiler correctly identified this based on the function, the current code is still safe as long dev->of_node is non-NULL for the case of CONFIG_ACPI=n, which is currently the case. The warning is now disabled by default, but still appears when building with W=1, and other build test tools should be able to detect it as well. Adding an #else clause here makes the code more robust and makes it clear to the compiler that this cannot happen. Signed-off-by: Arnd Bergmann Fixes: 8089a96f601b ("drivers: net: xgene: Add backward compatibility") --- drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.9.0 diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index 7714b7d4026a..98779fe2d558 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev) netdev_err(ndev, "Could not connect to PHY\n"); return -ENODEV; } +#else + return -ENODEV; #endif }