linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless
@ 2024-05-15  3:30 Chen Ni
  2024-05-15 14:59 ` Rahul Rameshbabu
  2024-05-23 12:17 ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Chen Ni @ 2024-05-15  3:30 UTC (permalink / raw)
  To: rrameshbabu, jikos, bentiss; +Cc: linux-input, linux-kernel, Chen Ni

Add check for the return value of input_ff_create_memless() and return
the error if it fails in order to catch the error.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/hid/hid-nvidia-shield.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
index 58b15750dbb0..ff9078ad1961 100644
--- a/drivers/hid/hid-nvidia-shield.c
+++ b/drivers/hid/hid-nvidia-shield.c
@@ -283,7 +283,9 @@ static struct input_dev *shield_haptics_create(
 		return haptics;
 
 	input_set_capability(haptics, EV_FF, FF_RUMBLE);
-	input_ff_create_memless(haptics, NULL, play_effect);
+	ret = input_ff_create_memless(haptics, NULL, play_effect);
+	if (ret)
+		goto err;
 
 	ret = input_register_device(haptics);
 	if (ret)
-- 
2.25.1


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

* Re: [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless
  2024-05-15  3:30 [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless Chen Ni
@ 2024-05-15 14:59 ` Rahul Rameshbabu
  2024-05-15 15:48   ` Benjamin Tissoires
  2024-05-23 12:17 ` Jiri Kosina
  1 sibling, 1 reply; 4+ messages in thread
From: Rahul Rameshbabu @ 2024-05-15 14:59 UTC (permalink / raw)
  To: Chen Ni; +Cc: jikos, bentiss, linux-input, linux-kernel


On Wed, 15 May, 2024 11:30:51 +0800 Chen Ni <nichen@iscas.ac.cn> wrote:
> Add check for the return value of input_ff_create_memless() and return
> the error if it fails in order to catch the error.
>

You will need a Fixes: tag here.

Fixes: 09308562d4af ("HID: nvidia-shield: Initial driver implementation with Thunderstrike support")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/hid/hid-nvidia-shield.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
> index 58b15750dbb0..ff9078ad1961 100644
> --- a/drivers/hid/hid-nvidia-shield.c
> +++ b/drivers/hid/hid-nvidia-shield.c
> @@ -283,7 +283,9 @@ static struct input_dev *shield_haptics_create(
>  		return haptics;
>  
>  	input_set_capability(haptics, EV_FF, FF_RUMBLE);
> -	input_ff_create_memless(haptics, NULL, play_effect);
> +	ret = input_ff_create_memless(haptics, NULL, play_effect);
> +	if (ret)
> +		goto err;
>  
>  	ret = input_register_device(haptics);
>  	if (ret)

I applied and tested the patch locally, and it looked good. If Jiri or
Benjamin can apply the patch with the updated trailer, then you can add
my Reviewed-by: trailer.

Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>

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

* Re: [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless
  2024-05-15 14:59 ` Rahul Rameshbabu
@ 2024-05-15 15:48   ` Benjamin Tissoires
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2024-05-15 15:48 UTC (permalink / raw)
  To: Rahul Rameshbabu; +Cc: Chen Ni, jikos, linux-input, linux-kernel

On May 15 2024, Rahul Rameshbabu wrote:
> 
> On Wed, 15 May, 2024 11:30:51 +0800 Chen Ni <nichen@iscas.ac.cn> wrote:
> > Add check for the return value of input_ff_create_memless() and return
> > the error if it fails in order to catch the error.
> >
> 
> You will need a Fixes: tag here.
> 
> Fixes: 09308562d4af ("HID: nvidia-shield: Initial driver implementation with Thunderstrike support")
> > Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> > ---
> >  drivers/hid/hid-nvidia-shield.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
> > index 58b15750dbb0..ff9078ad1961 100644
> > --- a/drivers/hid/hid-nvidia-shield.c
> > +++ b/drivers/hid/hid-nvidia-shield.c
> > @@ -283,7 +283,9 @@ static struct input_dev *shield_haptics_create(
> >  		return haptics;
> >  
> >  	input_set_capability(haptics, EV_FF, FF_RUMBLE);
> > -	input_ff_create_memless(haptics, NULL, play_effect);
> > +	ret = input_ff_create_memless(haptics, NULL, play_effect);
> > +	if (ret)
> > +		goto err;
> >  
> >  	ret = input_register_device(haptics);
> >  	if (ret)
> 
> I applied and tested the patch locally, and it looked good. If Jiri or
> Benjamin can apply the patch with the updated trailer, then you can add
> my Reviewed-by: trailer.
> 
> Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>


Thanks a lot for the patch and the review.

I wanted to apply it but we have a regression upstream on the CI because
of an unrelated change in selftests:
https://gitlab.freedesktop.org/bentiss/hid/-/jobs/58744845

Once this is sorted out I'll apply the patch (or Jiri will). FWIW, b4
applies the Fixes tag all by itself, so I don't have extra steps to do
:)

Cheers,
Benjamin

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

* Re: [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless
  2024-05-15  3:30 [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless Chen Ni
  2024-05-15 14:59 ` Rahul Rameshbabu
@ 2024-05-23 12:17 ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2024-05-23 12:17 UTC (permalink / raw)
  To: Chen Ni; +Cc: rrameshbabu, bentiss, linux-input, linux-kernel

On Wed, 15 May 2024, Chen Ni wrote:

> Add check for the return value of input_ff_create_memless() and return
> the error if it fails in order to catch the error.
> 
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/hid/hid-nvidia-shield.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-nvidia-shield.c b/drivers/hid/hid-nvidia-shield.c
> index 58b15750dbb0..ff9078ad1961 100644
> --- a/drivers/hid/hid-nvidia-shield.c
> +++ b/drivers/hid/hid-nvidia-shield.c
> @@ -283,7 +283,9 @@ static struct input_dev *shield_haptics_create(
>  		return haptics;
>  
>  	input_set_capability(haptics, EV_FF, FF_RUMBLE);
> -	input_ff_create_memless(haptics, NULL, play_effect);
> +	ret = input_ff_create_memless(haptics, NULL, play_effect);
> +	if (ret)
> +		goto err;
>  

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2024-05-23 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15  3:30 [PATCH] HID: nvidia-shield: Add missing check for input_ff_create_memless Chen Ni
2024-05-15 14:59 ` Rahul Rameshbabu
2024-05-15 15:48   ` Benjamin Tissoires
2024-05-23 12:17 ` 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).