/* When non-active we'll update virtual framebuffer, but no new urbs */
        atomic_set(&dev->usb_active, 0);
  
-       /* remove udlfb's sysfs interfaces */
-       for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++)
-               device_remove_file(info->dev, &fb_device_attrs[i]);
-       device_remove_bin_file(info->dev, &edid_attr);
-       unlink_framebuffer(info);
+       /* this function will wait for all in-flight urbs to complete */
+       dlfb_free_urb_list(dev);
+ 
+       if (info) {
 -
+               /* remove udlfb's sysfs interfaces */
+               for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++)
+                       device_remove_file(info->dev, &fb_device_attrs[i]);
+               device_remove_bin_file(info->dev, &edid_attr);
 -
 -              /* it's safe to uncomment next line if your kernel
 -                 doesn't yet have this function exported */
+               unlink_framebuffer(info);
+       }
+ 
        usb_set_intfdata(interface, NULL);
+       dev->udev = NULL;
+       dev->gdev = NULL;
  
        /* if clients still have us open, will be freed on last close */
        if (dev->fb_count == 0)