mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 21:37:25 +02:00
HID: cp2112: destroy mutex on driver detach
Use the devres variant of mutex_init() in order to free resources allocated with mutex debugging enabled. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
5e06802b42
commit
a99548b834
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/hidraw.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/nls.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include <linux/usb/ch9.h>
|
||||
|
|
@ -1205,7 +1206,11 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|||
if (!dev->in_out_buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&dev->lock);
|
||||
ret = devm_mutex_init(&hdev->dev, &dev->lock);
|
||||
if (ret) {
|
||||
hid_err(hdev, "mutex init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
if (ret) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user