Input: iforce - fix oops on device disconnect
[cascardo/linux.git] / drivers / input / joystick / iforce / iforce-main.c
index f6c688c..acc3a9e 100644 (file)
@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev)
        return 0;
 }
 
-static void iforce_release(struct input_dev *dev)
+static void iforce_close(struct input_dev *dev)
 {
        struct iforce *iforce = input_get_drvdata(dev);
        int i;
@@ -230,28 +230,12 @@ static void iforce_release(struct input_dev *dev)
                iforce_send_packet(iforce, FF_CMD_ENABLE, "\001");
        }
 
-       switch (iforce->bus) {
-#ifdef CONFIG_JOYSTICK_IFORCE_USB
-               case IFORCE_USB:
-                       usb_kill_urb(iforce->irq);
-
-                       /* The device was unplugged before the file
-                        * was released */
-                       if (iforce->usbdev == NULL) {
-                               iforce_delete_device(iforce);
-                               kfree(iforce);
-                       }
-               break;
-#endif
-       }
-}
-
-void iforce_delete_device(struct iforce *iforce)
-{
        switch (iforce->bus) {
 #ifdef CONFIG_JOYSTICK_IFORCE_USB
        case IFORCE_USB:
-               iforce_usb_delete(iforce);
+               usb_kill_urb(iforce->irq);
+               usb_kill_urb(iforce->out);
+               usb_kill_urb(iforce->ctrl);
                break;
 #endif
 #ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -303,7 +287,7 @@ int iforce_init_device(struct iforce *iforce)
 
        input_dev->name = "Unknown I-Force device";
        input_dev->open = iforce_open;
-       input_dev->close = iforce_release;
+       input_dev->close = iforce_close;
 
 /*
  * On-device memory allocation.