summaryrefslogtreecommitdiff
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2021-06-07 10:27:27 +0200
committerDavid S. Miller <davem@davemloft.net>2021-06-07 13:23:02 -0700
commit2c9d6c2b871d5841ce26ede3e81fd37e2e33c42c (patch)
tree63e8ff315e0f029ab7ffdeb408a53e9322526342 /drivers/net/usb
parent06edf1a940be0633499e2feea31d380375a22bd9 (diff)
usbnet: run unbind() before unregister_netdev()
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>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/usbnet.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ecf62849f4c1..57a5a025255c 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -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);