]> git.baikalelectronics.ru Git - kernel.git/commitdiff
usbnet: run unbind() before unregister_netdev()
authorOleksij Rempel <o.rempel@pengutronix.de>
Mon, 7 Jun 2021 08:27:27 +0000 (10:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jun 2021 20:23:02 +0000 (13:23 -0700)
unbind() is the proper place to disconnect PHY, but it will fail if
netdev is already unregistered.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/usbnet.c

index ecf62849f4c1fccbca9c82bfab00ee7d395279d2..57a5a025255c1a7aa6f4c90089cfa7ebc6c5cb72 100644 (file)
@@ -1597,6 +1597,9 @@ void usbnet_disconnect (struct usb_interface *intf)
                   xdev->bus->bus_name, xdev->devpath,
                   dev->driver_info->description);
 
+       if (dev->driver_info->unbind)
+               dev->driver_info->unbind(dev, intf);
+
        net = dev->net;
        unregister_netdev (net);
 
@@ -1604,9 +1607,6 @@ void usbnet_disconnect (struct usb_interface *intf)
 
        usb_scuttle_anchored_urbs(&dev->deferred);
 
-       if (dev->driver_info->unbind)
-               dev->driver_info->unbind (dev, intf);
-
        usb_kill_urb(dev->interrupt);
        usb_free_urb(dev->interrupt);
        kfree(dev->padding_pkt);