From patchwork Mon Nov 28 18:24:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9449883 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 218F960756 for ; Mon, 28 Nov 2016 18:28:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17E5D27FB6 for ; Mon, 28 Nov 2016 18:28:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C08D27FBB; Mon, 28 Nov 2016 18:28:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9601E27FB6 for ; Mon, 28 Nov 2016 18:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753021AbcK1S1c (ORCPT ); Mon, 28 Nov 2016 13:27:32 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36295 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbcK1S12 (ORCPT ); Mon, 28 Nov 2016 13:27:28 -0500 Received: by mail-lf0-f67.google.com with SMTP id o20so10330110lfg.3; Mon, 28 Nov 2016 10:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=mfo6c1AjKv19SRvILKUhu4iOeTzOTgtkexFA8v8WZ+U=; b=bSN8mbCvl9NqQ7zSHpqeksCl8zp9y4vNRZdqldsPSohEgYcAdjQe2m6W2g3/eoPk+n 1piXvOAtbA+3kz2MQfo6ayOo4RxP0brkkCWURKPD2dmHC71w7YtXlMClAZ5up/e2BACN GFs4gP+KLzgvGE+lzROcAmuPMu+aBWgGS+qZVJh2STzfiWDnRuZSkSMC6vXEA0ejwZff y41+luuYDAagvgE4YeCPMPIeEat4BhYmU+boM+a/HPXA27Tnrq2MwWyg+bJipR+Ix6Im /beHfmBJAL+Yp8quyjRElUh9YKlHIdCB7BKzh/UzofDPuU2BDQuus+o9g1xxGOo+njAM HBAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=mfo6c1AjKv19SRvILKUhu4iOeTzOTgtkexFA8v8WZ+U=; b=ibZXxxeEXj+rqhjeT9LskS6DT3Qpqm7k6JyQUei1t00fQT023M3/DamwTkVgcpQI/f WljXKS9wr6DmoUpvVm0YJZE+k4Q9bK/NKtARbV9mDWFvw1OqrTLTnu4Iv6CK9qpf8kEN Rh1ORot0c+zzJLbErhKSa9dE+3SLj81wCtSPhOxqbG7OTosFRQeM7X/0zuz9JCWsnkqE u2jo/PQ/+WKo19vIZ2nQu45mC7U/2+DKVMLEqFiWO9MkDlsTsByVtT0CuPJXZFparHNy qazmUb3KWozbXLZSu27uY3gGYh0iXp0hFPTGMYtETUOf8Bdx5ZrNFezbv4XQNJ0dzTl/ I/AA== X-Gm-Message-State: AKaTC0306K0p+HrCwgmI26ExriLpfCx4hGQ8g4vh0y1nwi2KO6fBJ3zDs0AIIH4L5AGWIA== X-Received: by 10.25.92.131 with SMTP id u3mr8862232lfi.15.1480357646223; Mon, 28 Nov 2016 10:27:26 -0800 (PST) Received: from xi.terra (c-04aadb54.07-184-6d6c6d4.cust.bredbandsbolaget.se. [84.219.170.4]) by smtp.gmail.com with ESMTPSA id s189sm13138163lja.3.2016.11.28.10.27.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 10:27:26 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.87) (envelope-from ) id 1cBQeA-0007KF-5k; Mon, 28 Nov 2016 19:27:22 +0100 From: Johan Hovold To: "David S. Miller" Cc: Vince Bridgers , Florian Fainelli , Fugang Duan , Pantelis Antoniou , Vitaly Bordug , Claudiu Manoil , Li Yang , Thomas Petazzoni , Felix Fietkau , John Crispin , Matthias Brugger , Sergei Shtylyov , Lars Persson , Mugunthan V N , Grygorii Strashko , Rob Herring , Frank Rowand , Andrew Lunn , Vivien Didelot , netdev@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Johan Hovold Subject: [PATCH net 04/16] net: ethernet: aurora: nb8800: fix fixed-link phydev leaks Date: Mon, 28 Nov 2016 19:24:57 +0100 Message-Id: <1480357509-28074-5-git-send-email-johan@kernel.org> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480357509-28074-1-git-send-email-johan@kernel.org> References: <1480357509-28074-1-git-send-email-johan@kernel.org> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure to deregister and free any fixed-link PHY registered using of_phy_register_fixed_link() on probe errors and on driver unbind. Fixes: c7dfe3abf40e ("net: ethernet: nb8800: support fixed-link DT node") Signed-off-by: Johan Hovold --- drivers/net/ethernet/aurora/nb8800.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index 00c38bf151e6..e078d8da978c 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c @@ -1466,12 +1466,12 @@ static int nb8800_probe(struct platform_device *pdev) ret = nb8800_hw_init(dev); if (ret) - goto err_free_bus; + goto err_deregister_fixed_link; if (ops && ops->init) { ret = ops->init(dev); if (ret) - goto err_free_bus; + goto err_deregister_fixed_link; } dev->netdev_ops = &nb8800_netdev_ops; @@ -1504,6 +1504,9 @@ static int nb8800_probe(struct platform_device *pdev) err_free_dma: nb8800_dma_free(dev); +err_deregister_fixed_link: + if (of_phy_is_fixed_link(pdev->dev.of_node)) + of_phy_deregister_fixed_link(pdev->dev.of_node); err_free_bus: of_node_put(priv->phy_node); mdiobus_unregister(bus); @@ -1521,6 +1524,8 @@ static int nb8800_remove(struct platform_device *pdev) struct nb8800_priv *priv = netdev_priv(ndev); unregister_netdev(ndev); + if (of_phy_is_fixed_link(pdev->dev.of_node)) + of_phy_deregister_fixed_link(pdev->dev.of_node); of_node_put(priv->phy_node); mdiobus_unregister(priv->mii_bus);