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: 9449979 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 7E5226071C for ; Mon, 28 Nov 2016 18:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73F5D25D97 for ; Mon, 28 Nov 2016 18:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 654A527F8D; Mon, 28 Nov 2016 18:32:16 +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=unavailable 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 2504A25D97 for ; Mon, 28 Nov 2016 18:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751432AbcK1S2m (ORCPT ); Mon, 28 Nov 2016 13:28:42 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33747 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbcK1S1c (ORCPT ); Mon, 28 Nov 2016 13:27:32 -0500 Received: by mail-lf0-f66.google.com with SMTP id 98so10306022lfs.0; Mon, 28 Nov 2016 10:27:30 -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=Gdc5M5iX2zYehVHKlae2zjHcB6yg2loaDN/wcww/S4oS+2Xv7rUJmQxS1ervhnRQv4 +zZ7oLIaIUIewOjvozswuEm33wzCY5HGp5CkXEDBPkiR7BPhZp4pVewkfxaoWrsF2CFl fWDSPsQV0cX4V5IgBOoGdQqEQGfhcdjvwh/JR5c/PBey/aANvGBVtVwgaHkToRM31Me0 pzzzwqlJD+Iz9ng2cYmz75xY2tD6mQrtRCtwxW7kf4dVtk6VVKiXd70eXszKEmtfUoIs 2C6tm3Bv/bZNPSFNAtbVtplKc8apHLVar2LTrL9YR/liQWg7CBMZ2Pvg/TDlojxEkA4j L0vA== X-Gm-Message-State: AKaTC00nloIM0uA9AS+wd5jwzZBrGkHv9nQWTKdfy5ba3a04AmVoCOQsXz/vQ9e/weLD8g== 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" 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 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> 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: 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);