All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] HID: alps: fix error return code in alps_input_configured()
@ 2016-09-21 15:12 Wei Yongjun
  2016-09-22  7:35 ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2016-09-21 15:12 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Henrik Rydberg; +Cc: Wei Yongjun, linux-input

From: Wei Yongjun <weiyongjun1@huawei.com>

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/hid/hid-alps.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
index 2808da9..507372e 100644
--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 
 		input2 = input_allocate_device();
 		if (!input2) {
-			input_free_device(input2);
+			ret = -ENOMEM;
 			goto exit;
 		}
 
@@ -426,7 +426,8 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 		__set_bit(INPUT_PROP_POINTER, input2->propbit);
 		__set_bit(INPUT_PROP_POINTING_STICK, input2->propbit);
 
-		if (input_register_device(data->input2)) {
+		ret = input_register_device(data->input2);
+		if (ret) {
 			input_free_device(input2);
 			goto exit;
 		}




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

* Re: [PATCH -next] HID: alps: fix error return code in alps_input_configured()
  2016-09-21 15:12 [PATCH -next] HID: alps: fix error return code in alps_input_configured() Wei Yongjun
@ 2016-09-22  7:35 ` Benjamin Tissoires
  2016-09-22  9:10   ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2016-09-22  7:35 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Jiri Kosina, Henrik Rydberg, Wei Yongjun, linux-input

On Sep 21 2016 or thereabouts, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/hid/hid-alps.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
> index 2808da9..507372e 100644
> --- a/drivers/hid/hid-alps.c
> +++ b/drivers/hid/hid-alps.c
> @@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
>  
>  		input2 = input_allocate_device();
>  		if (!input2) {
> -			input_free_device(input2);

Tiny nitpick: this change is not entirely related to the patch and
commit message. But it's OK-ish carrying this over through this patch.
(it's basically a no-op given that input2 is null).

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> +			ret = -ENOMEM;
>  			goto exit;
>  		}
>  
> @@ -426,7 +426,8 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
>  		__set_bit(INPUT_PROP_POINTER, input2->propbit);
>  		__set_bit(INPUT_PROP_POINTING_STICK, input2->propbit);
>  
> -		if (input_register_device(data->input2)) {
> +		ret = input_register_device(data->input2);
> +		if (ret) {
>  			input_free_device(input2);
>  			goto exit;
>  		}
> 
> 
> 

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

* Re: [PATCH -next] HID: alps: fix error return code in alps_input_configured()
  2016-09-22  7:35 ` Benjamin Tissoires
@ 2016-09-22  9:10   ` Jiri Kosina
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2016-09-22  9:10 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: Wei Yongjun, Henrik Rydberg, Wei Yongjun, linux-input

On Thu, 22 Sep 2016, Benjamin Tissoires wrote:

> > Fix to return a negative error code from the error handling
> > case instead of 0, as done elsewhere in this function.
> > 
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/hid/hid-alps.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
> > index 2808da9..507372e 100644
> > --- a/drivers/hid/hid-alps.c
> > +++ b/drivers/hid/hid-alps.c
> > @@ -384,7 +384,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
> >  
> >  		input2 = input_allocate_device();
> >  		if (!input2) {
> > -			input_free_device(input2);
> 
> Tiny nitpick: this change is not entirely related to the patch and
> commit message. But it's OK-ish carrying this over through this patch.
> (it's basically a no-op given that input2 is null).
> 
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Fair enough; I've ammended the changelog to reflect the removal of 
superfluous input_free_device() call and applied, thanks.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2016-09-22  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 15:12 [PATCH -next] HID: alps: fix error return code in alps_input_configured() Wei Yongjun
2016-09-22  7:35 ` Benjamin Tissoires
2016-09-22  9:10   ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.