HID: Never call hid_free_buffers() when usbhid_device has been freed
authorJiri Kosina <jkosina@suse.cz>
Wed, 1 Aug 2007 10:32:27 +0000 (12:32 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 2 Aug 2007 11:48:04 +0000 (13:48 +0200)
We can't call hid_free_buffers() when the underlying usbhid_device
has already been freed.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c

index 6e7393460ead1fb75abece8b0160d9e084183953..0a1f2b52a12fa4bab847f905e8f5069e87cb5944 100644 (file)
@@ -877,9 +877,9 @@ fail:
        usb_free_urb(usbhid->urbin);
        usb_free_urb(usbhid->urbout);
        usb_free_urb(usbhid->urbctrl);
+       hid_free_buffers(dev, hid);
        kfree(usbhid);
 fail_no_usbhid:
-       hid_free_buffers(dev, hid);
        hid_free_device(hid);
 
        return NULL;
@@ -913,9 +913,9 @@ static void hid_disconnect(struct usb_interface *intf)
        usb_free_urb(usbhid->urbin);
        usb_free_urb(usbhid->urbctrl);
        usb_free_urb(usbhid->urbout);
-       kfree(usbhid);
 
        hid_free_buffers(hid_to_usb_dev(hid), hid);
+       kfree(usbhid);
        hid_free_device(hid);
 }