Thread (48 messages) flat view 48 messages, 8 authors, 2021-08-28

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

From: Alvin Šipraga <hidden>
Date: 2021-08-22 22:33:15
Also in: lkml, netdev

Hi Andrew,

On 8/22/21 11:40 PM, Andrew Lunn wrote:
On Sun, Aug 22, 2021 at 09:31:39PM +0200, Alvin Šipraga wrote:
quoted
From: Alvin Šipraga <redacted>

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?
No, there isn't. I neglected to mention in the rtl8365mb patch that I 
reworked the IRQ setup (compared with rtl8366rb) so that it could be 
torn down in a neat way. So you will see that the new driver does it 
properly, but I did not touch rtl8366rb because I am not using it. I am 
happy to do the same to rtl8366rb but I don't think I should make it 
part of this series. What do you think?
This patch however loos O.K.

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

     Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help