diff mbox series

HID: wacom: Added error check

Message ID 20230427114745.53136-1-arefev@swemel.ru (mailing list archive)
State Mainlined
Commit 16a9c24f24fbe4564284eb575b18cc20586b9270
Delegated to: Jiri Kosina
Headers show
Series HID: wacom: Added error check | expand

Commit Message

Denis Arefev April 27, 2023, 11:47 a.m. UTC
Added a variable check and
   transition in case of an error

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

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/hid/wacom_sys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Ping Cheng April 27, 2023, 5:56 p.m. UTC | #1
On Thu, Apr 27, 2023 at 5:07 AM Denis Arefev <arefev@swemel.ru> wrote:
>
>    Added a variable check and
>    transition in case of an error
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Denis Arefev <arefev@swemel.ru>

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

Reviewed-by: Ping Cheng <ping.cheng@wacom.com>

Cheers,
Ping

> ---
>  drivers/hid/wacom_sys.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index fb538a6c4add..aff4a21a46b6 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -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
>
Jiri Kosina May 23, 2023, 1:12 p.m. UTC | #2
On Thu, 27 Apr 2023, Denis Arefev wrote:

>    Added a variable check and
>    transition in case of an error
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index fb538a6c4add..aff4a21a46b6 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -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);