From: Bartosz Golaszewski Date: Wed, 23 Apr 2025 08:55:39 +0000 (+0200) Subject: HID: cp2112: destroy mutex on driver detach X-Git-Tag: v6.16-rc1~64^2~5^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a99548b8343a46c1050fc041314bbbd27065169d;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Linus Walleij Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index f4c8d981aa0a8..a001b9acd2d4a 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -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) {