Commit 76052749 authored by Jiri Kosina's avatar Jiri Kosina Committed by Linus Torvalds

HID: fix hid->hiddev initialization in hiddev_connect()

Commit 07903407 ("HID: hiddev cleanup -- handle all error conditions
properly") by mistake removed proper initialization of hid->hiddev pointer
in hiddev_connect() in case usb_register_dev() succeeds for the hiddev node.
Put it properly back in place.
Reported-and-tested-by: default avatarGabriel C <nix.or.die@googlemail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 940fbf41
...@@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) ...@@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
INIT_LIST_HEAD(&hiddev->list); INIT_LIST_HEAD(&hiddev->list);
spin_lock_init(&hiddev->list_lock); spin_lock_init(&hiddev->list_lock);
mutex_init(&hiddev->existancelock); mutex_init(&hiddev->existancelock);
hid->hiddev = hiddev;
hiddev->hid = hid; hiddev->hid = hid;
hiddev->exist = 1; hiddev->exist = 1;
retval = usb_register_dev(usbhid->intf, &hiddev_class); retval = usb_register_dev(usbhid->intf, &hiddev_class);
if (retval) { if (retval) {
err_hid("Not able to get a minor for this device."); err_hid("Not able to get a minor for this device.");
hid->hiddev = NULL;
kfree(hiddev); kfree(hiddev);
return -1; return -1;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment