diff options
author | 2025-04-23 10:55:39 +0200 | |
---|---|---|
committer | 2025-04-24 12:07:55 +0200 | |
commit | a99548b8343a46c1050fc041314bbbd27065169d (patch) | |
tree | ff218f4fa6a6426d764fabff014161a3ca0383e0 | |
parent | Merge tag 'hid-for-linus-2025032601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid (diff) | |
download | wireguard-linux-a99548b8343a46c1050fc041314bbbd27065169d.tar.xz wireguard-linux-a99548b8343a46c1050fc041314bbbd27065169d.zip |
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>
-rw-r--r-- | drivers/hid/hid-cp2112.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index f4c8d981aa0a..a001b9acd2d4 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -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) { |