Skip to content

Commit

Permalink
HID: unlock on error path in hid_device_probe()
Browse files Browse the repository at this point in the history
We recently introduced locking into this function, but we missed an
error path which needs an unlock.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
error27 authored and Jiri Kosina committed Aug 24, 2011
1 parent 54d3339 commit ba623a7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -1656,7 +1658,7 @@ static int hid_device_probe(struct device *dev)
if (ret)
hdev->driver = NULL;
}

unlock:
up(&hdev->driver_lock);
return ret;
}
Expand Down

0 comments on commit ba623a7

Please sign in to comment.