Thread (5 messages) 5 messages, 5 authors, 2022-09-21

Re: [PATCH] HID: nintendo: deregister home LED when it fails

From: Benjamin Tissoires <hidden>
Date: 2022-09-21 08:57:36
Also in: lkml

On Apr 15 2022, Icenowy Zheng wrote:
quoted hunk ↗ jump to hunk
Some Pro Controller compatible controllers do not support home LED, and
will fail when setting it. Currently this leads to probe failure.

Change the code that fails probing to deregistering home LED.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/hid/hid-nintendo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index 2204de889739..ed93287c3afc 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -1900,9 +1900,8 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
 		/* Set the home LED to 0 as default state */
 		ret = joycon_home_led_brightness_set(led, 0);
 		if (ret) {
-			hid_err(hdev, "Failed to set home LED dflt; ret=%d\n",
-									ret);
-			return ret;
+			hid_warn(hdev, "Failed to set home LED dflt, unregistering home LED");
I have s/dflt/default/ and applied to for-6.1/nintendo in hid.git

FWIW, I wondered really hard if we should or not clean up led->name that
devm_kzalloc-ed just a few lines above, but in the end it doesn't add
much to do it now instead of at remove time.

Thanks for the patch and the reviews!

Cheers,
Benjamin
+			devm_led_classdev_unregister(&hdev->dev, led);
 		}
 	}
 
-- 
2.35.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help