Skip to contentSkip to conversation

HID: wacom: Added error check

PATCH Applied Denis Arefev 3 participants 3 messages Apr 27, 2023 – May 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: wacom: Added error check

Added a variable check and
transition in case of an error

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/hid/wacom_sys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +6 -1
index fb538a6c4add..aff4a21a46b6 100644
@@ -2417,8 +2417,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
 		goto fail_quirks;
 	}
 
-	if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
+	if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
 		error = hid_hw_open(hdev);
+		if (error) {
+			hid_err(hdev, "hw open failed\n");
+			goto fail_quirks;
+		}
+	}
 
 	wacom_set_shared_values(wacom_wac);
 	devres_close_group(&hdev->dev, wacom);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Denis Arefev

Added a variable check and
transition in case of an error

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Thank you Denis for working on the patch! The patch LGTM.

Cheers,
Ping

Quoted 26 lines
---
 drivers/hid/wacom_sys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hid/wacom_sys.c +6 -2
index fb538a6c4add..aff4a21a46b6 100644
@@ -2417,8 +2417,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
                goto fail_quirks;
        }
 
-       if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
+       if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
                error = hid_hw_open(hdev);
+               if (error) {
+                       hid_err(hdev, "hw open failed\n");
+                       goto fail_quirks;
+               }
+       }
 
        wacom_set_shared_values(wacom_wac);
        devres_close_group(&hdev->dev, wacom);
--

2.25.1

maintainer Applied
#2 lore raw
In reply to Denis Arefev
Quoted 4 lines · Denis Arefev

Added a variable check and
transition in case of an error

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs