diff options
author | Dan Carpenter <error27@gmail.com> | 2011-08-24 07:27:46 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-08-24 10:39:23 -0400 |
commit | ba623a774f5b529f89b3d63e0837df52e16ffb3b (patch) | |
tree | 445b7da37ff5d883e5aaa3159950c89936d944b1 /drivers/hid/hid-core.c | |
parent | 54d3339ac127bbf1efd3ae5a1f520a6c302c952a (diff) |
HID: unlock on error path in hid_device_probe()
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>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r-- | drivers/hid/hid-core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index d34eb34dbe25..d98332b11009 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1642,8 +1642,10 @@ static int hid_device_probe(struct device *dev) | |||
1642 | 1642 | ||
1643 | if (!hdev->driver) { | 1643 | if (!hdev->driver) { |
1644 | id = hid_match_device(hdev, hdrv); | 1644 | id = hid_match_device(hdev, hdrv); |
1645 | if (id == NULL) | 1645 | if (id == NULL) { |
1646 | return -ENODEV; | 1646 | ret = -ENODEV; |
1647 | goto unlock; | ||
1648 | } | ||
1647 | 1649 | ||
1648 | hdev->driver = hdrv; | 1650 | hdev->driver = hdrv; |
1649 | if (hdrv->probe) { | 1651 | if (hdrv->probe) { |
@@ -1656,7 +1658,7 @@ static int hid_device_probe(struct device *dev) | |||
1656 | if (ret) | 1658 | if (ret) |
1657 | hdev->driver = NULL; | 1659 | hdev->driver = NULL; |
1658 | } | 1660 | } |
1659 | 1661 | unlock: | |
1660 | up(&hdev->driver_lock); | 1662 | up(&hdev->driver_lock); |
1661 | return ret; | 1663 | return ret; |
1662 | } | 1664 | } |