On Fri, Nov 20, 2026 at 04:48:02PM -0800, Florian Fainelli wrote:
> Balance phy_connect() on probe failure and removal. Otherwise device
> and module references taken during PHY attachment leak, and the PHY
> retains an attached_dev pointer to the freed netdev. The attachment path
> uses PHY polling, so there is no PHY interrupt to release. Disconnect
> before unregistering the bus while its MDIO callbacks and MAC registers
> remain usable.
>
> PHY teardown can re-enable the MAC for MDIO even if the interface was
> never opened. Reset the MAC after PHY and MDIO bus teardown, before
> releasing descriptors and register mappings. Skip MAC control accesses
> when mac_enabled is clear, since stopping an already clock-gated MAC
> hangs MTX-1. This guard also covers the existing probe failure path:
> au1000_probe() resets and gates the MAC before register_netdev(), and
> registration failure reaches another reset in err_out. If no intervening
> MDIO access has re-enabled the MAC, that second reset must not touch its
> control register. Always clear the DMA descriptor control bits and TX
> state.
>
> Fixes: 0638dec01e89 ("[PATCH] net: au1000_eth: PHY framework conversion")
> Signed-off-by: Florian Fainelli <f.fa…@gmail.com>
Reviewed-by: Simon Horman <hor…@kernel.org>