From: Christian Marangi <ansuelsmth@gmail.com>
To: win847@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v12 12/12] net: airoha: add phylink support
Date: Mon, 10 Aug 2026 16:57:59 +0200 [thread overview]
Message-ID: <6a79e6fa.332d3c56.21a33c.bff8@mx.google.com> (raw)
In-Reply-To: <6a79e5dd.e59e62a9.3bd15b.cd58@mx.google.com>
On Mon, Aug 10, 2026 at 10:53:13PM +0800, win847@gmail.com wrote:
> On Sun, 9 Aug 2026, Christian Marangi wrote:
> > Subject: [PATCH net-next v12 12/12] net: airoha: add phylink support
>
> Hi Christian,
>
> Thanks for the series. I have a question about the error path in
> `airoha_dev_open()` introduced in this patch, and a suggested cleanup.
>
> In the new code:
>
> err = phylink_of_phy_connect(dev->phylink, netdev->dev.of_node, 0);
> if (err) {
> netdev_err(netdev, "could not attach PHY: %d\n", err);
> return err;
> }
>
> phylink_start(dev->phylink);
>
> netif_tx_start_all_queues(netdev);
> err = airoha_set_vip_for_gdm_port(dev, true);
> if (err)
> return err;
>
> If `airoha_set_vip_for_gdm_port(dev, true)` fails after both
> `phylink_of_phy_connect()` and `phylink_start()` have already run, we
> return `err` directly without doing `phylink_stop()` or
> `phylink_disconnect_phy()`. That leaves the phylink in a started /
> PHY-connected state. On the next `ndo_open`, `phylink_of_phy_connect()`
> will be called again and may fail because the PHY is already connected,
> preventing the interface from ever coming back up again.
>
> I understand `airoha_set_vip_for_gdm_port()` currently always returns 0
> (based on v12), so today this is a dead path, but it is easy to make the
> error handling correct and defensive so a future change to that helper
> does not silently break reopen.
>
> Suggested change: add an `err_phy_stop` error label and unwind phylink
> before returning:
>
> netif_tx_start_all_queues(netdev);
> err = airoha_set_vip_for_gdm_port(dev, true);
> if (err)
> goto err_phy_stop;
>
> return 0;
>
> err_phy_stop:
> netif_tx_stop_all_queues(netdev);
> phylink_stop(dev->phylink);
> phylink_disconnect_phy(dev->phylink);
> return err;
>
> Would you be open to folding this in (or reordering so `phylink_start()`
> runs after the VIP setup, leaving fewer error exits that need phylink
> teardown)? Happy to write it up as a proper patch if useful.
>
If you are ok, I can integrate the change in the next revision.
--
Ansuel
next prev parent reply other threads:[~2026-08-10 14:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 20:30 [PATCH net-next v12 00/12] net: pcs: Introduce support for fwnode PCS Christian Marangi
2026-08-09 20:30 ` [PATCH net-next v12 01/12] net: phylink: keep and use MAC supported_interfaces in phylink struct Christian Marangi
2026-08-09 20:30 ` [PATCH net-next v12 02/12] net: phylink: introduce internal phylink PCS handling Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 03/12] net: pcs: implement Firmware node support for PCS driver Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 04/12] net: phylink: save phylink instance fwnode on phylink_create Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 05/12] net: phylink: support PCS provider release Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 06/12] net: phylink: support late PCS provider attach Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 07/12] net: Document PCS subsystem Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 08/12] MAINTAINERS: add myself as PCS subsystem maintainer Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 09/12] net: phylink: add .pcs_link_down PCS OP Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 10/12] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 11/12] net: pcs: airoha: add PCS driver for Airoha AN7581 SoC Christian Marangi
2026-08-09 20:31 ` [PATCH net-next v12 12/12] net: airoha: add phylink support Christian Marangi
2026-08-10 14:53 ` win847
2026-08-10 14:57 ` Christian Marangi [this message]
2026-08-10 15:32 ` win847
[not found] <6a79e6fa.332d3c56.21a33c.b60f@mx.google.com>
2026-08-10 15:14 ` win847
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=6a79e6fa.332d3c56.21a33c.bff8@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=win847@gmail.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