The flag of RTL8152_UNPLUG should only be set when the device is
unplugged, not each time the rtl8152_disconnect() is called.
Otherwise, the device wouldn't be stopped normally.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 
        usb_set_intfdata(intf, NULL);
        if (tp) {
-               set_bit(RTL8152_UNPLUG, &tp->flags);
+               struct usb_device *udev = tp->udev;
+
+               if (udev->state == USB_STATE_NOTATTACHED)
+                       set_bit(RTL8152_UNPLUG, &tp->flags);
+
                tasklet_kill(&tp->tl);
                unregister_netdev(tp->netdev);
                tp->rtl_ops.unload(tp);