mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiawen Liu <1298662399@qq.com>
To: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] leds: rgb: fail grouped LED probe if cleanup cannot be registered
Date: Sun, 29 Nov 2026 17:44:38 +0400	[thread overview]
Message-ID: <tencent_492089751D9C72019D7FB92B87EAA98B5209@qq.com> (raw)

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


                 reply	other threads:[~2026-11-29 13:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_492089751D9C72019D7FB92B87EAA98B5209@qq.com \
    --to=1298662399@qq.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®