dm: flush queued bios when process blocks to avoid deadlock
[firefly-linux-kernel-4.4.55.git] / drivers / net / usb / usbnet.c
index 060918f49fea82779a37d326a4d1729189ddad28..c2ea4e5666fb965fd089f27cfbdee5715cd66538 100644 (file)
@@ -1662,12 +1662,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
         * bind() should set rx_urb_size in that case.
         */
        dev->hard_mtu = net->mtu + net->hard_header_len;
-#if 0
-// dma_supported() is deeply broken on almost all architectures
-       // possible with some EHCI controllers
-       if (dma_supported (&udev->dev, DMA_BIT_MASK(64)))
-               net->features |= NETIF_F_HIGHDMA;
-#endif
 
        net->netdev_ops = &usbnet_netdev_ops;
        net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
@@ -1772,6 +1766,13 @@ out3:
        if (info->unbind)
                info->unbind (dev, udev);
 out1:
+       /* subdrivers must undo all they did in bind() if they
+        * fail it, but we may fail later and a deferred kevent
+        * may trigger an error resubmitting itself and, worse,
+        * schedule a timer. So we kill it all just in case.
+        */
+       cancel_work_sync(&dev->kevent);
+       del_timer_sync(&dev->delay);
        free_netdev(net);
 out:
        return status;