[PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered
From: Jiawen Liu
Date: Sun Nov 29 2026 - 08:44:50 EST
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@xxxxxx>
---
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