HID: fix hid->hiddev initialization in hiddev_connect()
authorJiri Kosina <jkosina@suse.cz>
Wed, 7 Jan 2009 12:25:36 +0000 (13:25 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 7 Jan 2009 19:30:57 +0000 (11:30 -0800)
Commit 079034073fa ("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: Gabriel C <nix.or.die@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/hid/usbhid/hiddev.c

index 6a98f9f572b04f1033cbbf20dc27bf36747d3f7e..d73eea382ab3879c93a0c74db2833d47ead87f6f 100644 (file)
@@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
        INIT_LIST_HEAD(&hiddev->list);
        spin_lock_init(&hiddev->list_lock);
        mutex_init(&hiddev->existancelock);
+       hid->hiddev = hiddev;
        hiddev->hid = hid;
        hiddev->exist = 1;
 
        retval = usb_register_dev(usbhid->intf, &hiddev_class);
        if (retval) {
                err_hid("Not able to get a minor for this device.");
+               hid->hiddev = NULL;
                kfree(hiddev);
                return -1;
        } else {