Skip to content

Commit

Permalink
HID: usbhid: initialize interface pointers early enough
Browse files Browse the repository at this point in the history
Move the initialization of USB interface pointers from _start()
over to _probe() callback, which is where it belongs.

This fixes case where interface is NULL when parsing of report
descriptor fails.

LKML-Reference: <20100213135720.603e5f64@neptune.home>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Feb 17, 2010
1 parent 7f978b9 commit 57ab12e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/hid/usbhid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,6 @@ static int usbhid_start(struct hid_device *hid)

spin_lock_init(&usbhid->lock);

usbhid->intf = intf;
usbhid->ifnum = interface->desc.bInterfaceNumber;

usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
if (!usbhid->urbctrl) {
ret = -ENOMEM;
Expand Down Expand Up @@ -1178,6 +1175,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *

hid->driver_data = usbhid;
usbhid->hid = hid;
usbhid->intf = intf;
usbhid->ifnum = interface->desc.bInterfaceNumber;

ret = hid_add_device(hid);
if (ret) {
Expand Down

0 comments on commit 57ab12e

Please sign in to comment.