From patchwork Mon Oct 17 22:16:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101670 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp597464qge; Mon, 17 Oct 2016 15:18:07 -0700 (PDT) X-Received: by 10.98.17.196 with SMTP id 65mr26948397pfr.55.1476742687120; Mon, 17 Oct 2016 15:18:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l19si32450989pfb.294.2016.10.17.15.18.06; Mon, 17 Oct 2016 15:18:07 -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 S1759418AbcJQWRm (ORCPT + 4 others); Mon, 17 Oct 2016 18:17:42 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:59226 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758713AbcJQWRd (ORCPT ); Mon, 17 Oct 2016 18:17:33 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0LxfAZ-1d2qL72K79-017FLJ; Tue, 18 Oct 2016 00:16:54 +0200 From: Arnd Bergmann To: "David S. Miller" Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Philippe Reynes , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Andrew Lunn , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 20/28] net: bcm63xx: avoid referencing uninitialized variable Date: Tue, 18 Oct 2016 00:16:08 +0200 Message-Id: <20161017221650.1902729-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:Qlt/bq3UpqmBT2sU2G040zH/dnBf9yLi0Wko5hP0pv8iLKXWjqR 6QThf2kW51lgvg3RcoaONq77wVacgLkVCGJZuQ8XfLRkqv0r9Zc4uCpaUpfNqYdipjE2snV RxUlXTGz1fbHlIWzI3jFYPfGF9VKAOo6/I45lBwoqPEw/jSUF6xew9NznoeBpisLHfF1t2X n/Zi8ihZ3WfIs4lP0Etww== X-UI-Out-Filterresults: notjunk:1; V01:K0:x3X0HHXmORo=:2UznytWLJN0BdXSZbgt/xr +13A2eviW7ECh1HJvk3Ag3k5YknGbm19lbst9qeUB+haA22oyqZp6kwQBonAgqRac8+M92WhV kHwZXpqPr7LPa0RG+ovS0I+MAgCj+zmmL/Emj1XybvYZ9OPHa+IyKOhhlIdyMo0Vgr7He2H9F Wyto0Eecu9/JnY4zkoE5tridGspHt0eOXjlVZx82MduJ7jZRT9KzWKsRGF6wGupB0pUHIhWhi U7VU4CzaH4ToDCQ97MQs8ixnoMgOR18eiZ0N8Z7FXLcm0BWQ65cnTRgyJWDUEGlSdJm/Jn0xC o45pKnfeTRLafYvq5AnVUvahm5C9t/qrKStdkbiQDnVXJeB+xlOQ6P7OlrMuahEQkd7QCPDHG ru8aKEdlSPL8/uQOF6+HO/7/95ajibhITh8O0lmcs5xqFheZ2Ou+KFchTLtKJWP+JAa/T2HCJ aqFbGKur3ZyN29tmHx5/AKuG7CwKEi1BVAzqykD+z2ZLIjvEH8ZIWGipxXfgsfPuPVX6M6PcZ 5LFC/6Ub5a9ffBGCIQaVZchYPilPee775ZlWvy9mGWq3hzj0D3R1XPx+HAoVgGZUH47Ty9aW+ FdtaxqHt7pSjbboDa35v+qweQMSwMpFoEDgIDAjb3NpA2wZe4Mev/CAI5eRgbJbQoFZi1RABR ALZSb971GNjvctbSU21zJUOH6h3mnpT8ga/wV1zqEjhS9Vd76+Avzq+EbMoslTYfi3N4= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org gcc found a reference to an uninitialized variable in the error handling of bcm_enet_open, introduced by a recent cleanup: drivers/net/ethernet/broadcom/bcm63xx_enet.c: In function 'bcm_enet_open' drivers/net/ethernet/broadcom/bcm63xx_enet.c:1129:2: warning: 'phydev' may be used uninitialized in this function [-Wmaybe-uninitialized] This makes the use of that variable conditional, so we only reference it here after it has been used before. Unlike my normal patches, I have not build-tested this one, as I don't currently have mips test in my randconfig setup. Fixes: 625eb8667d6f ("net: ethernet: broadcom: bcm63xx: use phydev from struct net_device") Cc: Philippe Reynes Reported-by: kbuild test robot Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index ae364c7..5370909 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1126,7 +1126,8 @@ static int bcm_enet_open(struct net_device *dev) free_irq(dev->irq, dev); out_phy_disconnect: - phy_disconnect(phydev); + if (priv->has_phy) + phy_disconnect(phydev); return ret; }