Re: [RFC PATCH net-next 1/5] net: dsa: realtek-smi: fix mdio_free bug on module unload

Andrew Lunn
2021-08-22T21:41:13Z

On Sun, Aug 22, 2021 at 09:31:39PM +0200, Alvin Šipraga wrote:
> From: Alvin Šipraga <alsi@bang-olufsen.dk>
>
> realtek-smi-core fails to unregister the slave MII bus on module unload,
> raising the following BUG warning:
>
> mdio_bus.c:650: BUG_ON(bus->state != MDIOBUS_UNREGISTERED);
>
> kernel BUG at drivers/net/phy/mdio_bus.c:650!
> Internal error: Oops - BUG: 0 [#1] PREEMPT_RT SMP
> Call trace:
> mdiobus_free+0x4c/0x50
> devm_mdiobus_free+0x18/0x20
> release_nodes.isra.0+0x1c0/0x2b0
> devres_release_all+0x38/0x58
> device_release_driver_internal+0x124/0x1e8
> driver_detach+0x54/0xe0
> bus_remove_driver+0x60/0xd8
> driver_unregister+0x34/0x60
> platform_driver_unregister+0x18/0x20
> realtek_smi_driver_exit+0x14/0x1c [realtek_smi]
>
> Fix this by duly unregistering the slave MII bus with
> mdiobus_unregister. We do this in the DSA teardown path, since
> registration is performed in the DSA setup path.

Looking at the setup code, is there anything undoing what
rtl8366rb_setup_cascaded_irq() does?

This patch however loos O.K.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Andrew