linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hid: hid-alps: fix error return code in alps_input_configured()
@ 2021-03-04 13:19 Jia-Ju Bai
  2021-03-08 10:34 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-03-04 13:19 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, rydberg; +Cc: linux-input, linux-kernel, Jia-Ju Bai

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;
 		}
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hid: hid-alps: fix error return code in alps_input_configured()
  2021-03-04 13:19 [PATCH] hid: hid-alps: fix error return code in alps_input_configured() Jia-Ju Bai
@ 2021-03-08 10:34 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2021-03-08 10:34 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: benjamin.tissoires, rydberg, linux-input, linux-kernel

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.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-08 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 13:19 [PATCH] hid: hid-alps: fix error return code in alps_input_configured() Jia-Ju Bai
2021-03-08 10:34 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).