Skip to contentSkip to conversation

hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event

PATCH Applied Hangyu Hua 2 participants 3 messages Aug 12, 2022 – Sep 20, 2022

Subsystems (3)
lore
Share & tools
lore

Hangyu Hua

author
#0 lore raw

PATCH 1/1 hid: hid-logitech-hidpp: avoid unnecessary assignments in hidpp_connect_event

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")
---
 drivers/hid/hid-logitech-hidpp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index 68f9e9d207f4..c3602bf8f9b9 100644
@@ -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;
 }
Signature · 1 line
2.25.1
author
#1 lore raw
Quoted 15 lines · 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")
---
  drivers/hid/hid-logitech-hidpp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +0 -0
index 68f9e9d207f4..c3602bf8f9b9 100644
@@ -3959,8 +3959,10 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
  	hidpp_populate_input(hidpp, input);

drivers/hid/hid-logitech-hidpp.c static void hidpp_connect_event(struct hidpp_device *hidpp) · line 3968

Quoted 10 lines
drivers/hid/hid-logitech-hidpp.c +3 -1
 
  	ret = input_register_device(input);
-	if (ret)
+	if (ret) {
  		input_free_device(input);
+		return;
+	}
 
  	hidpp->delayed_input = input;
  }

Gentel ping.

#2 lore raw
Quoted 25 lines · Hangyu Hua
Quoted 23 lines · 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")
---
  drivers/hid/hid-logitech-hidpp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-hidpp.c +3 -1
index 68f9e9d207f4..c3602bf8f9b9 100644
@@ -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;
+     }
 
Quoted 4 lines

drivers/hid/hid-logitech-hidpp.c static void hidpp_connect_event(struct hidpp_device *hidpp) · line 3968

Quoted 2 lines
drivers/hid/hid-logitech-hidpp.c +0 -0
      hidpp->delayed_input = input;
  }

Gentel ping.

Applied to for-6.1/logitech in hid.git

Sorry for the delay

Cheers,
Benjamin