Linux LED subsystem development
 help / color / mirror / Atom feed
* [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered
@ 2026-11-29 13:44 Jiawen Liu
  2026-11-29 13:50 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 13:44 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek; +Cc: linux-leds, linux-kernel

The grouped multicolor LED driver disables sysfs write access for each
member LED, then registers a devres action that restores access when the
group is destroyed. If registering a restore action fails, the reset
helper immediately re-enables writes for that member, but the probe
ignores the error and successfully binds the group.

Propagate the registration failure so the group cannot become available
with a writable member LED.

Fixes: 37d0849ed392 ("leds: rgb: Add a multicolor LED driver to group monochromatic LEDs")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/leds/rgb/leds-group-multicolor.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c
index 34c5ec2ea91f6..e548176d6abe6 100644
--- a/drivers/leds/rgb/leds-group-multicolor.c
+++ b/drivers/leds/rgb/leds-group-multicolor.c
@@ -145,7 +145,12 @@ static int leds_gmc_probe(struct platform_device *pdev)
 		mutex_unlock(&led_cdev->led_access);
 
 		/* Restore the write access to the LED sysfs when the group is destroyed */
-		devm_add_action_or_reset(dev, restore_sysfs_write_access, led_cdev);
+		ret = devm_add_action_or_reset(dev, restore_sysfs_write_access,
+					       led_cdev);
+		if (ret)
+			return dev_err_probe(dev, ret,
+					     "failed to install cleanup for %s.\n",
+					     led_cdev->name);
 	}
 
 	return 0;
-- 
2.34.1


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

* Re: [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered
  2026-11-29 13:44 [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered Jiawen Liu
@ 2026-11-29 13:50 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 13:50 UTC (permalink / raw)
  To: Jiawen Liu; +Cc: linux-leds, lee

> The grouped multicolor LED driver disables sysfs write access for each
> member LED, then registers a devres action that restores access when the
> group is destroyed. If registering a restore action fails, the reset
> helper immediately re-enables writes for that member, but the probe
> ignores the error and successfully binds the group.
> 
> Propagate the registration failure so the group cannot become available
> with a writable member LED.
> 
> Fixes: 37d0849ed392 ("leds: rgb: Add a multicolor LED driver to group monochromatic LEDs")
> Signed-off-by: Jiawen Liu <1298662399@qq.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_492089751D9C72019D7FB92B87EAA98B5209@qq.com?part=1

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

end of thread, other threads:[~2026-11-29 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:44 [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered Jiawen Liu
2026-11-29 13:50 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox