linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event
@ 2022-08-12  2:55 Hangyu Hua
  2022-09-06  7:57 ` Hangyu Hua
  0 siblings, 1 reply; 3+ messages in thread
From: Hangyu Hua @ 2022-08-12  2:55 UTC (permalink / raw)
  To: lains, jikos, benjamin.tissoires; +Cc: linux-input, linux-kernel, Hangyu Hua

hidpp->delayed_input can't be assigned to an object that already call
input_free_device when input_register_device fails.

Fixes: c39e3d5fc9dd ("HID: logitech-hidpp: late bind the input device on wireless connection")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 68f9e9d207f4..c3602bf8f9b9 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -3959,8 +3959,10 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
 	hidpp_populate_input(hidpp, input);
 
 	ret = input_register_device(input);
-	if (ret)
+	if (ret) {
 		input_free_device(input);
+		return;
+	}
 
 	hidpp->delayed_input = input;
 }
-- 
2.25.1


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

* Re: [PATCH] hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event
  2022-08-12  2:55 [PATCH] hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event Hangyu Hua
@ 2022-09-06  7:57 ` Hangyu Hua
  2022-09-20 13:36   ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Hangyu Hua @ 2022-09-06  7:57 UTC (permalink / raw)
  To: lains, jikos, benjamin.tissoires; +Cc: linux-input, linux-kernel

On 12/8/2022 10:55, Hangyu Hua wrote:
> hidpp->delayed_input can't be assigned to an object that already call
> input_free_device when input_register_device fails.
> 
> Fixes: c39e3d5fc9dd ("HID: logitech-hidpp: late bind the input device on wireless connection")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
>   drivers/hid/hid-logitech-hidpp.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 68f9e9d207f4..c3602bf8f9b9 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -3959,8 +3959,10 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
>   	hidpp_populate_input(hidpp, input);
>   
>   	ret = input_register_device(input);
> -	if (ret)
> +	if (ret) {
>   		input_free_device(input);
> +		return;
> +	}
>   
>   	hidpp->delayed_input = input;
>   }
Gentel ping.

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

* Re: [PATCH] hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event
  2022-09-06  7:57 ` Hangyu Hua
@ 2022-09-20 13:36   ` Benjamin Tissoires
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2022-09-20 13:36 UTC (permalink / raw)
  To: Hangyu Hua; +Cc: Filipe Laíns, Jiri Kosina, open list:HID CORE LAYER, lkml

On Tue, Sep 6, 2022 at 9:57 AM Hangyu Hua <hbh25y@gmail.com> wrote:
>
> On 12/8/2022 10:55, Hangyu Hua wrote:
> > hidpp->delayed_input can't be assigned to an object that already call
> > input_free_device when input_register_device fails.
> >
> > Fixes: c39e3d5fc9dd ("HID: logitech-hidpp: late bind the input device on wireless connection")
> > Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> > ---
> >   drivers/hid/hid-logitech-hidpp.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> > index 68f9e9d207f4..c3602bf8f9b9 100644
> > --- a/drivers/hid/hid-logitech-hidpp.c
> > +++ b/drivers/hid/hid-logitech-hidpp.c
> > @@ -3959,8 +3959,10 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
> >       hidpp_populate_input(hidpp, input);
> >
> >       ret = input_register_device(input);
> > -     if (ret)
> > +     if (ret) {
> >               input_free_device(input);
> > +             return;
> > +     }
> >
> >       hidpp->delayed_input = input;
> >   }
> Gentel ping.
>

Applied to for-6.1/logitech in hid.git

Sorry for the delay

Cheers,
Benjamin


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

end of thread, other threads:[~2022-09-20 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12  2:55 [PATCH] hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event Hangyu Hua
2022-09-06  7:57 ` Hangyu Hua
2022-09-20 13:36   ` Benjamin Tissoires

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).