Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Wentao Liang
Tue, 03 Nov 2026 10:29
[PATCH RESEND] net: stmmac: drop the runtime PM reference on probe failure
Author: Wentao Liang
Date: Tue, 03 Nov 2026 10:29
Date: Tue, 03 Nov 2026 10:29
56 lines
10202 bytes
10202 bytes
__stmmac_dvr_probe() takes a runtime PM reference with
pm_runtime_get_noresume() and enables runtime PM before registering the
MDIO bus. The reference is only dropped on the success path, so a
failure of the MDIO, PCS, phylink, devlink or netdev registration leaves
the usage counter elevated. The device is never bound in that case, so
stmmac_dvr_remove() never runs to release it.
Drop the reference and disable runtime PM again on the common error path.
Only disable runtime PM if this driver enabled it, because PCI devices
already have it enabled by the PCI core.
Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 049d85b3e25f..eebf1975f40f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7974,6 +7974,7 @@ static int __stmmac_dvr_probe(struct device *device,
struct net_device *ndev = NULL;
struct stmmac_priv *priv;
int i, ret = 0;
+ bool pm_enabled = false;
u8 rxq;
if (!plat_dat->dma_cfg || !plat_dat->dma_cfg->pbl) {
@@ -8223,8 +8224,10 @@ static int __stmmac_dvr_probe(struct device *device,
pm_runtime_get_noresume(device);
pm_runtime_set_active(device);
- if (!pm_runtime_enabled(device))
+ if (!pm_runtime_enabled(device)) {
pm_runtime_enable(device);
+ pm_enabled = true;
+ }
ret = stmmac_mdio_register(ndev);
if (ret < 0) {
@@ -8278,6 +8281,9 @@ static int __stmmac_dvr_probe(struct device *device,
error_pcs_setup:
stmmac_mdio_unregister(ndev);
error_mdio_register:
+ if (pm_enabled)
+ pm_runtime_disable(device);
+ pm_runtime_put_noidle(device);
stmmac_napi_del(ndev);
error_hw_init:
destroy_workqueue(priv->wq);
--
2.34.1
Re: [PATCH RESEND] net: stmmac: drop the runtime PM reference on probe failure
Author: netdev-bot+sinfo
Date: Tue, 03 Nov 2026 10:35
Date: Tue, 03 Nov 2026 10:35
26 lines
9108 bytes
9108 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. - What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH RESEND] net: stmmac: drop the runtime PM reference on probe failure
Author: Krzysztof Kozlowski
Date: Tue, 03 Nov 2026 10:39
Date: Tue, 03 Nov 2026 10:39
21 lines
11790 bytes
11790 bytes
On 03/11/2026 11:29, Wentao Liang wrote:
> __stmmac_dvr_probe() takes a runtime PM reference with
> pm_runtime_get_noresume() and enables runtime PM before registering the
> MDIO bus. The reference is only dropped on the success path, so a
> failure of the MDIO, PCS, phylink, devlink or netdev registration leaves
> the usage counter elevated. The device is never bound in that case, so
> stmmac_dvr_remove() never runs to release it.
>
> Drop the reference and disable runtime PM again on the common error path.
> Only disable runtime PM if this driver enabled it, because PCI devices
> already have it enabled by the PCI core.
>
> Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Implement comments you received, instead of resending.
Best regards,
Krzysztof
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads