[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480357509-28074-12-git-send-email-johan@kernel.org>
Date: Mon, 28 Nov 2016 19:25:04 +0100
From: Johan Hovold <johan@...nel.org>
To: "David S. Miller" <davem@...emloft.net>
Cc: Vince Bridgers <vbridger@...nsource.altera.com>,
Florian Fainelli <f.fainelli@...il.com>,
Fugang Duan <fugang.duan@....com>,
Pantelis Antoniou <pantelis.antoniou@...il.com>,
Vitaly Bordug <vbordug@...mvista.com>,
Claudiu Manoil <claudiu.manoil@...escale.com>,
Li Yang <leoli@...escale.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Felix Fietkau <nbd@...nwrt.org>,
John Crispin <blogic@...nwrt.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
Lars Persson <lars.persson@...s.com>,
Mugunthan V N <mugunthanvnm@...com>,
Grygorii Strashko <grygorii.strashko@...com>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org, nios2-dev@...ts.rocketboards.org,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-mediatek@...ts.infradead.org,
linux-renesas-soc@...r.kernel.org, linux-omap@...r.kernel.org,
devicetree@...r.kernel.org, Johan Hovold <johan@...nel.org>
Subject: [PATCH net 11/16] net: ethernet: marvell: mvneta: fix fixed-link phydev leaks
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 <johan@...nel.org>
---
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);
--
2.7.3
Powered by blists - more mailing lists