diff mbox series

hid: hid-alps: fix error return code in alps_input_configured()

Message ID 20210304131957.7089-1-baijiaju1990@gmail.com (mailing list archive)
State Mainlined
Commit fa8ba6e5dc0e78e409e503ddcfceef5dd96527f4
Delegated to: Jiri Kosina
Headers show
Series hid: hid-alps: fix error return code in alps_input_configured() | expand

Commit Message

Jia-Ju Bai March 4, 2021, 1:19 p.m. UTC
When input_register_device() fails, no error return code is assigned.
To fix this bug, ret is assigned with -ENOENT as error return code.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/hid/hid-alps.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jiri Kosina March 8, 2021, 10:34 a.m. UTC | #1
On Thu, 4 Mar 2021, Jia-Ju Bai wrote:

> When input_register_device() fails, no error return code is assigned.
> To fix this bug, ret is assigned with -ENOENT as error return code.
> 
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/hid/hid-alps.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
> index 3feaece13ade..6b665931147d 100644
> --- a/drivers/hid/hid-alps.c
> +++ b/drivers/hid/hid-alps.c
> @@ -761,6 +761,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
>  
>  		if (input_register_device(data->input2)) {
>  			input_free_device(input2);
> +			ret = -ENOENT;
>  			goto exit;
>  		}
>  	}

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
index 3feaece13ade..6b665931147d 100644
--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -761,6 +761,7 @@  static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 
 		if (input_register_device(data->input2)) {
 			input_free_device(input2);
+			ret = -ENOENT;
 			goto exit;
 		}
 	}