Re: [PATCH net] net: lpc_eth: release the PHY device node reference

From: Vladimir Zapolskiy

Date: Wed Oct 28 2026 - 05:59:27 EST


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@xxxxxxxxx>

The change is correct, thank you for the fix!

Reviewed-by: Vladimir Zapolskiy <vz@xxxxxxxxxx>

--
Best wishes,
Vladimir