gelic_net_setup_netdev() registers the Ethernet netdev before wireless
initialization. When wireless initialization fails, the probe error
path calls free_netdev() while the Ethernet netdev is still registered,
triggering the registration-state BUG_ON().
Unregister the Ethernet netdev before entering the probe cleanup.
Found it by self-developed static analysis tool and compile-test
passed.
Fixes: 09dde54c6a69 ("PS3: gelic: Add wireless support for PS3")
Signed-off-by: Wanhui Fu <fuwh…@163.com>
---
drivers/net/ethernet/toshiba/ps3_gelic_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index d35d1f3c10a1..dc660326bc12 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -1801,6 +1801,7 @@ static int ps3_gelic_driver_probe(struct ps3_system_bus_device *dev)
result = gelic_wl_driver_probe(card);
if (result) {
dev_dbg(&dev->core, "%s: WL init failed\n", __func__);
+ unregister_netdev(netdev);
goto fail_setup_netdev;
}
#endif
--
2.25.1