From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
To: netdev@vger.kernel.org, andrew@lunn.ch, maxime.chevallier@bootlin.com
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
linux-kernel@vger.kernel.org,
Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Subject: [PATCH net v2 0/5] net: phy: fix cleanup after probe failure
Date: Thu, 13 Aug 2026 21:29:40 +0800 [thread overview]
Message-ID: <20260813132946.116176-1-xuanqiang.luo@linux.dev> (raw)
From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
phy_probe() initializes the PHY driver, ports, SFP upstream, and LEDs in
stages. Its error paths do not always release only the resources acquired
at each stage or restore the PHY device state.
Port setup also leaves SFP cleanup split between phy_sfp_probe(),
phy_setup_ports(), and phy_probe(), and default port setup ignores errors
from attaching the port to the PHY driver.
This series makes each initialization layer own its cleanup.
Patch 1 splits the phy_probe() cleanup by initialization stage.
Patch 2 makes SFP and port setup unwind their resources in the required
order.
Patch 3 restores the PHY device state after probe failure.
Patch 4 calls the PHY driver remove callback after later probe failures.
Patch 5 propagates errors from default port setup.
---
Changes:
v2:
Patch 1:
- Limit this patch to splitting phy_probe() error paths, moving the SFP
teardown fixes to Patch 2.
Patch 2 (new):
- makes SFP and port setup unwind their resources in the required order.
- Add phy_sfp_release() for complete SFP teardown instead of open-coding
sfp_bus_del_upstream(). (Andrew Lunn, Maxime Chevallier.)
Patch 3 (new):
- Restore PHY_DOWN and clear phydev->drv after probe failure.
Patch 4:
- Move the former Patch 2 to Patch 4; no functional changes.
Patch 5 (new):
- Propagate errors from default port setup.
v1: https://lore.kernel.org/all/20260812125127.106255-1-xuanqiang.luo@linux.dev/
Xuanqiang Luo (5):
net: phy: split phy_probe() error paths
net: phy: unregister SFP upstream before port cleanup
net: phy: restore device state after probe failure
net: phy: call driver remove when core initialization fails
net: phy: propagate errors from default port setup
drivers/net/phy/phy_device.c | 77 +++++++++++++++++++++++++++---------
1 file changed, 58 insertions(+), 19 deletions(-)
base-commit: f5bbbfec59b4e2fb7520a91de3df8a6174325d6a
--
2.43.0
next reply other threads:[~2026-08-13 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 13:29 Xuanqiang Luo [this message]
2026-08-13 13:29 ` [PATCH net v2 1/5] net: phy: split phy_probe() error paths Xuanqiang Luo
2026-08-13 13:29 ` [PATCH net v2 2/5] net: phy: unregister SFP upstream before port cleanup Xuanqiang Luo
2026-08-13 13:29 ` [PATCH net v2 3/5] net: phy: restore device state after probe failure Xuanqiang Luo
2026-08-13 13:29 ` [PATCH net v2 4/5] net: phy: call driver remove when core initialization fails Xuanqiang Luo
2026-08-13 13:29 ` [PATCH net v2 5/5] net: phy: propagate errors from default port setup Xuanqiang Luo
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=20260813132946.116176-1-xuanqiang.luo@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luoxuanqiang@kylinos.cn \
--cc=maxime.chevallier@bootlin.com \
--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