OSDN Git Service

net: sfp: fix unbind
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 3 Dec 2019 23:51:22 +0000 (23:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Dec 2019 00:56:42 +0000 (16:56 -0800)
When unbinding, we don't correctly tear down the module state, leaving
(for example) the hwmon registration behind. Ensure everything is
properly removed by sending a remove event at unbind.

Fixes: 6b0da5c9c1a3 ("net: sfp: track upstream's attachment state in state machine")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/sfp.c

index bdbbb76..c118d9f 100644 (file)
@@ -2294,6 +2294,10 @@ static int sfp_remove(struct platform_device *pdev)
 
        sfp_unregister_socket(sfp->sfp_bus);
 
+       rtnl_lock();
+       sfp_sm_event(sfp, SFP_E_REMOVE);
+       rtnl_unlock();
+
        return 0;
 }