aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-02-17 08:25:01 -0500
committerJiri Kosina <jkosina@suse.cz>2010-02-17 08:25:01 -0500
commit57ab12e418ec4fe24c11788bb1bbdabb29d05679 (patch)
tree33a6b687de72e088ad71b155acaf982c1adc97ac /drivers/hid
parent7f978b9bf535cbbd1ae8d9fbdd7c4f60ab38f260 (diff)
HID: usbhid: initialize interface pointers early enough
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/usbhid/hid-core.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 74bd3ca220d3..ceaf4a14b67b 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1005,9 +1005,6 @@ static int usbhid_start(struct hid_device *hid)
1005 1005
1006 spin_lock_init(&usbhid->lock); 1006 spin_lock_init(&usbhid->lock);
1007 1007
1008 usbhid->intf = intf;
1009 usbhid->ifnum = interface->desc.bInterfaceNumber;
1010
1011 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); 1008 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
1012 if (!usbhid->urbctrl) { 1009 if (!usbhid->urbctrl) {
1013 ret = -ENOMEM; 1010 ret = -ENOMEM;
@@ -1178,6 +1175,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1178 1175
1179 hid->driver_data = usbhid; 1176 hid->driver_data = usbhid;
1180 usbhid->hid = hid; 1177 usbhid->hid = hid;
1178 usbhid->intf = intf;
1179 usbhid->ifnum = interface->desc.bInterfaceNumber;
1181 1180
1182 ret = hid_add_device(hid); 1181 ret = hid_add_device(hid);
1183 if (ret) { 1182 if (ret) {