mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered
@ 2026-11-29 13:44 Jiawen Liu
  0 siblings, 0 replies; only message 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	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 13:44 UTC | newest]

Thread overview: (only message) (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

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

all inboxes | Powered by JetHome®