From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: Chris Snook <chris.snook@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk> (maintainer:SFF/SFP/SFP+
MODULE SUPPORT:Keyword:phylink\.h|struct\s+phylink|\.phylink|>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net 3/3] net: ag71xx: call phylink_destroy on failure
Date: Mon, 2 Feb 2026 13:46:34 -0800 [thread overview]
Message-ID: <20260202214634.72738-3-rosenp@gmail.com> (raw)
In-Reply-To: <20260202214634.72738-1-rosenp@gmail.com>
phylink_create has no devm equivalent and must therefore be handled
manually in probe and remove.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/atheros/ag71xx.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index 7114f2970ac6..285a99ee35f5 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -1921,8 +1921,6 @@ static int ag71xx_probe(struct platform_device *pdev)
if (err)
return err;
- platform_set_drvdata(pdev, ndev);
-
err = ag71xx_phylink_setup(ag);
if (err)
return dev_err_probe(&pdev->dev, err,
@@ -1931,25 +1929,29 @@ static int ag71xx_probe(struct platform_device *pdev)
err = register_netdev(ndev);
if (err) {
netif_err(ag, probe, ndev, "unable to register net device\n");
- platform_set_drvdata(pdev, NULL);
- return err;
+ goto err_phylink;
}
+ platform_set_drvdata(pdev, ndev);
+
netif_info(ag, probe, ndev, "Atheros AG71xx at 0x%08lx, irq %d, mode:%s\n",
(unsigned long)ag->mac_base, ndev->irq,
phy_modes(ag->phy_if_mode));
return 0;
+
+err_phylink:
+ phylink_destroy(ag->phylink);
+ return err;
}
static void ag71xx_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
-
- if (!ndev)
- return;
+ struct ag71xx *ag = netdev_priv(ndev);
unregister_netdev(ndev);
+ phylink_destroy(ag->phylink);
platform_set_drvdata(pdev, NULL);
}
--
2.52.0
next prev parent reply other threads:[~2026-02-02 21:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 21:46 [PATCH net 1/3] Revert "net: ag71xx: use devm for register_netdev" Rosen Penev
2026-02-02 21:46 ` [PATCH net 2/3] Revert "net: ag71xx: remove platform_set_drvdata" Rosen Penev
2026-02-02 21:46 ` Rosen Penev [this message]
2026-02-04 3:32 ` [PATCH net 3/3] net: ag71xx: call phylink_destroy on failure Jakub Kicinski
2026-02-03 10:28 ` [PATCH net 1/3] Revert "net: ag71xx: use devm for register_netdev" Bartosz Golaszewski
2026-02-03 19:52 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260202214634.72738-3-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox