HID: unlock on error path in hid_device_probe()
authorDan Carpenter <error27@gmail.com>
Wed, 24 Aug 2011 11:27:46 +0000 (14:27 +0300)
committerJiri Kosina <jkosina@suse.cz>
Wed, 24 Aug 2011 14:39:23 +0000 (16:39 +0200)
We recently introduced locking into this function, but we missed an
error path which needs an unlock.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-core.c

index d34eb34..d98332b 100644 (file)
@@ -1642,8 +1642,10 @@ static int hid_device_probe(struct device *dev)
 
        if (!hdev->driver) {
                id = hid_match_device(hdev, hdrv);
-               if (id == NULL)
-                       return -ENODEV;
+               if (id == NULL) {
+                       ret = -ENODEV;
+                       goto unlock;
+               }
 
                hdev->driver = hdrv;
                if (hdrv->probe) {
@@ -1656,7 +1658,7 @@ static int hid_device_probe(struct device *dev)
                if (ret)
                        hdev->driver = NULL;
        }
-
+unlock:
        up(&hdev->driver_lock);
        return ret;
 }