* [PATCH net] net: lpc_eth: release the PHY device node reference
@ 2026-10-22 15:59 Yige Jiang
2026-10-27 16:57 ` Simon Horman
2026-10-28 9:58 ` Vladimir Zapolskiy
0 siblings, 2 replies; 3+ messages in thread
From: Yige Jiang @ 2026-10-22 15:59 UTC (permalink / raw)
To: netdev
Cc: Yige Jiang, Vladimir Zapolskiy, Piotr Wojtaszczyk, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-arm-kernel, linux-kernel, Ma Ke
lpc_eth_drv_probe() obtains a reference to phy-handle and stores it in
pldat->phy_node for lpc_mii_probe(). Neither PHY lookup nor connecting
the PHY consumes that node reference. The probe error paths and driver
removal discard the stored pointer without releasing the reference.
Put the node at err_out_dma_unmap, which is reached by both failure
paths after the phandle lookup, and on remove after unregistering the
network device and MII bus. Both puts run before free_netdev(), since
pldat is stored in the netdev private area. Earlier probe failures do
not pass the new error-path put.
The PHY device reference discussed in the linked review is a different
reference. This patch only fixes the node reference, which was also
mentioned in that discussion; it does not repeat the proposed PHY
device cleanup.
LLM assistance was used for static ownership analysis and drafting of
this change and its changelog. The review traced get/put pairs, error
paths and teardown ordering. No runtime reproducer or hardware test
is available.
Fixes: 3503bf024b3e ("net: lpc_eth: parse phy nodes from device tree")
Link: https://patchwork.kernel.org/patch/14502432/
Assisted-by: LLM
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on net/main (305deb54c6c2).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
Both allyesconfig and allmodconfig completed kernel and module builds
on the unmodified baseline and with this patch. Unchanged objects were
reused for the patched builds. No new warnings were found compared
with the baseline, and the changed driver produced no warnings.
Both configurations used CONFIG_WERROR=n and DEBUG_INFO_NONE=y;
W=1 diagnostics remained enabled. CONFIG_LPC_ENET was y and m,
respectively. The unmodified WERROR=y baseline reproduces the earlier
arm64 syscall-table override-init failure.
No LPC32xx hardware, runtime or fault-injection test was performed.
drivers/net/ethernet/nxp/lpc_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 8b9a3e3bba30fd95258a9f58699af4a8f82ea04c..69098845baac0e4d1fbbb062c2a767acef7d266a 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1397,6 +1397,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
err_out_unregister_netdev:
unregister_netdev(ndev);
err_out_dma_unmap:
+ of_node_put(pldat->phy_node);
if (!use_iram_for_net(dev) ||
pldat->dma_buff_size > lpc32xx_return_iram(NULL, NULL))
dma_free_coherent(dev, pldat->dma_buff_size,
@@ -1435,6 +1436,7 @@ static void lpc_eth_drv_remove(struct platform_device *pdev)
mdiobus_free(pldat->mii_bus);
clk_disable_unprepare(pldat->clk);
clk_put(pldat->clk);
+ of_node_put(pldat->phy_node);
free_netdev(ndev);
}
base-commit: 305deb54c6c287e586bed92da2375ae1220e8dde
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: lpc_eth: release the PHY device node reference
2026-10-22 15:59 [PATCH net] net: lpc_eth: release the PHY device node reference Yige Jiang
@ 2026-10-27 16:57 ` Simon Horman
2026-10-28 9:58 ` Vladimir Zapolskiy
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-10-27 16:57 UTC (permalink / raw)
To: Yige Jiang
Cc: netdev, Vladimir Zapolskiy, Piotr Wojtaszczyk, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-arm-kernel, linux-kernel, Ma Ke
On Thu, Oct 22, 2026 at 11:59:55PM +0800, Yige Jiang wrote:
> lpc_eth_drv_probe() obtains a reference to phy-handle and stores it in
> pldat->phy_node for lpc_mii_probe(). Neither PHY lookup nor connecting
> the PHY consumes that node reference. The probe error paths and driver
> removal discard the stored pointer without releasing the reference.
>
> Put the node at err_out_dma_unmap, which is reached by both failure
> paths after the phandle lookup, and on remove after unregistering the
> network device and MII bus. Both puts run before free_netdev(), since
> pldat is stored in the netdev private area. Earlier probe failures do
> not pass the new error-path put.
>
> The PHY device reference discussed in the linked review is a different
> reference. This patch only fixes the node reference, which was also
> mentioned in that discussion; it does not repeat the proposed PHY
> device cleanup.
>
> LLM assistance was used for static ownership analysis and drafting of
> this change and its changelog. The review traced get/put pairs, error
> paths and teardown ordering. No runtime reproducer or hardware test
> is available.
>
> Fixes: 3503bf024b3e ("net: lpc_eth: parse phy nodes from device tree")
> Link: https://patchwork.kernel.org/patch/14502432/
> Assisted-by: LLM
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
> ---
> Based on net/main (305deb54c6c2).
> Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
> Both allyesconfig and allmodconfig completed kernel and module builds
> on the unmodified baseline and with this patch. Unchanged objects were
> reused for the patched builds. No new warnings were found compared
> with the baseline, and the changed driver produced no warnings.
> Both configurations used CONFIG_WERROR=n and DEBUG_INFO_NONE=y;
> W=1 diagnostics remained enabled. CONFIG_LPC_ENET was y and m,
> respectively. The unmodified WERROR=y baseline reproduces the earlier
> arm64 syscall-table override-init failure.
> No LPC32xx hardware, runtime or fault-injection test was performed.
Given the absence of run-time testing,
I'm unsure if this is net or net-next material.
But I agree this change is correct.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: lpc_eth: release the PHY device node reference
2026-10-22 15:59 [PATCH net] net: lpc_eth: release the PHY device node reference Yige Jiang
2026-10-27 16:57 ` Simon Horman
@ 2026-10-28 9:58 ` Vladimir Zapolskiy
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2026-10-28 9:58 UTC (permalink / raw)
To: Yige Jiang, netdev
Cc: Piotr Wojtaszczyk, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-arm-kernel, linux-kernel,
Ma Ke
On 10/22/26 18:59, Yige Jiang wrote:
> lpc_eth_drv_probe() obtains a reference to phy-handle and stores it in
> pldat->phy_node for lpc_mii_probe(). Neither PHY lookup nor connecting
> the PHY consumes that node reference. The probe error paths and driver
> removal discard the stored pointer without releasing the reference.
>
> Put the node at err_out_dma_unmap, which is reached by both failure
> paths after the phandle lookup, and on remove after unregistering the
> network device and MII bus. Both puts run before free_netdev(), since
> pldat is stored in the netdev private area. Earlier probe failures do
> not pass the new error-path put.
>
> The PHY device reference discussed in the linked review is a different
> reference. This patch only fixes the node reference, which was also
> mentioned in that discussion; it does not repeat the proposed PHY
> device cleanup.
>
> LLM assistance was used for static ownership analysis and drafting of
> this change and its changelog. The review traced get/put pairs, error
> paths and teardown ordering. No runtime reproducer or hardware test
> is available.
>
> Fixes: 3503bf024b3e ("net: lpc_eth: parse phy nodes from device tree")
> Link: https://patchwork.kernel.org/patch/14502432/
> Assisted-by: LLM
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
The change is correct, thank you for the fix!
Reviewed-by: Vladimir Zapolskiy <vz@kernel.org>
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-28 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 15:59 [PATCH net] net: lpc_eth: release the PHY device node reference Yige Jiang
2026-10-27 16:57 ` Simon Horman
2026-10-28 9:58 ` Vladimir Zapolskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®