From patchwork Mon Nov 28 18:25:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9449913 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 EC13B6071C for ; Mon, 28 Nov 2016 18:28:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E21FF27F9C for ; Mon, 28 Nov 2016 18:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D680C27FB6; Mon, 28 Nov 2016 18:28:24 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 984EF27F9C for ; Mon, 28 Nov 2016 18:28:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBQfA-0001gS-0F; Mon, 28 Nov 2016 18:28:24 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBQed-00014Z-Qb for linux-mediatek@lists.infradead.org; Mon, 28 Nov 2016 18:27:57 +0000 Received: by mail-lf0-x242.google.com with SMTP id 98so10306021lfs.0 for ; Mon, 28 Nov 2016 10:27:31 -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=MKGJuBoc9LG/KP/OM33IXDaicuT4tRWyaM6J+jxATjw=; b=1IRK/mZsKmF9gfVfdc2iEN1VFgdk0P6oCUTEag/pXTG3sLshfUJ9aHwFML6Gx3qtoZ gHN/jVgi0xJlhNNOsMPPZHBGuEfXQEdIWt5zlDmRpFub8ojaxWBwpxN5sCPgO10+fy+A D92Wigw0i6E1r1pNtM3o2T9s62FyVbcQoA2KztoZ81pNHvShGp5yHkZEp556JBJwMnuw 0S8pZn+UXU9FKVQg8pAE8EuAtfVkXfCOZ0ciHLr6fEibBeYPdwgcDCmXlet5cqKaOFva CcYwKvFnh7CRhGmd+6nNN2lnhy9vr/7eflqb9GTQMds0khPFPq9moAvyYmhOfSTs/htP Q8kg== 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=MKGJuBoc9LG/KP/OM33IXDaicuT4tRWyaM6J+jxATjw=; b=eBWcbRTboe0+iobBJnPRcxumBT8sXwb/gpF6/d08+EZvXhr+5l/T2yxvYzlhr7lPTI IBGGU6PuwNrAF9QModwLnlhvkvOxPCLOPnH9Rpz0skFV65cSnwpu1io3Dppp7N6kgGpf EoSSzu8cUQEEIGW5hY1hiMqAZx5YFhdjlcvmgqRq75fxOKt9GecmMa4kNXBW8fUfT497 L4132Sbrt4o7upPdiR6OENwLdSTb/FjtY8/6Ou7umA7seuZqP5akyl95xqSZDmmCnSIW UdVGj3JMbPxaphOhot46FUUMC5J634M1Dixi0PJgGQ2jY+qNfIFUljXicdiw2NRZMIyv AsTg== X-Gm-Message-State: AKaTC00X1xdO1wI5H/nMyvKq+uzmruiemFvDOHImhkGsXntuCc/eH1186Wv8/oKD6F2uDQ== X-Received: by 10.25.28.145 with SMTP id c139mr7198668lfc.167.1480357649544; Mon, 28 Nov 2016 10:27:29 -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 h63sm12986254ljh.20.2016.11.28.10.27.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 10:27:27 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.87) (envelope-from ) id 1cBQeA-0007Kq-NO; Mon, 28 Nov 2016 19:27:22 +0100 From: Johan Hovold To: "David S. Miller" Subject: [PATCH net 11/16] net: ethernet: marvell: mvneta: fix fixed-link phydev leaks Date: Mon, 28 Nov 2016 19:25:04 +0100 Message-Id: <1480357509-28074-12-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161128_102752_336948_B024B1CD X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , devicetree@vger.kernel.org, Pantelis Antoniou , Frank Rowand , Felix Fietkau , Florian Fainelli , Claudiu Manoil , Li Yang , Mugunthan V N , Grygorii Strashko , linuxppc-dev@lists.ozlabs.org, Johan Hovold , Rob Herring , linux-mediatek@lists.infradead.org, Lars Persson , Matthias Brugger , linux-omap@vger.kernel.org, John Crispin , Thomas Petazzoni , Fugang Duan , Sergei Shtylyov , Vivien Didelot , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Vitaly Bordug , nios2-dev@lists.rocketboards.org, Vince Bridgers MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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: 83895bedeee6 ("net: mvneta: add support for fixed links") Signed-off-by: Johan Hovold Reviewed-by: Thomas Petazzoni Signed-off-by: Johan Hovold Signed-off-by: David S. Miller --- drivers/net/ethernet/marvell/mvneta.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 0c0a45af950f..707bc4680b9b 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -4191,6 +4191,8 @@ static int mvneta_probe(struct platform_device *pdev) clk_disable_unprepare(pp->clk); err_put_phy_node: of_node_put(phy_node); + if (of_phy_is_fixed_link(dn)) + of_phy_deregister_fixed_link(dn); err_free_irq: irq_dispose_mapping(dev->irq); err_free_netdev: @@ -4202,6 +4204,7 @@ static int mvneta_probe(struct platform_device *pdev) static int mvneta_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); + struct device_node *dn = pdev->dev.of_node; struct mvneta_port *pp = netdev_priv(dev); unregister_netdev(dev); @@ -4209,6 +4212,8 @@ static int mvneta_remove(struct platform_device *pdev) clk_disable_unprepare(pp->clk); free_percpu(pp->ports); free_percpu(pp->stats); + if (of_phy_is_fixed_link(dn)) + of_phy_deregister_fixed_link(dn); irq_dispose_mapping(dev->irq); of_node_put(pp->phy_node); free_netdev(dev);