[PATCH] leds: leds-cros_ec: Skip LEDs without color components

Thomas Weißschuh posted 1 patch 3 months, 1 week ago
drivers/leds/leds-cros_ec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] leds: leds-cros_ec: Skip LEDs without color components
Posted by Thomas Weißschuh 3 months, 1 week ago
A user reports that on their Lenovo Corsola Magneton with EC firmware
steelix-15194.270.0 the driver probe fails with EINVAL. It turns out
that the power LED does not contain any color components as indicated
by the following "ectool led power query" output:

Brightness range for LED 1:
        red     : 0x0
        green   : 0x0
        blue    : 0x0
        yellow  : 0x0
        white   : 0x0
        amber   : 0x0

The LED also does not react to commands sent manually through ectool and
is generally non-functional.

Instead of failing the probe for all LEDs managed by the EC when one
without color components is encountered, silently skip those.

Fixes: 8d6ce6f3ec9d ("leds: Add ChromeOS EC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/leds/leds-cros_ec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-cros_ec.c b/drivers/leds/leds-cros_ec.c
index 377cf04e202a..bea3cc3fbfd2 100644
--- a/drivers/leds/leds-cros_ec.c
+++ b/drivers/leds/leds-cros_ec.c
@@ -142,9 +142,6 @@ static int cros_ec_led_count_subleds(struct device *dev,
 		}
 	}
 
-	if (!num_subleds)
-		return -EINVAL;
-
 	*max_brightness = common_range;
 	return num_subleds;
 }
@@ -189,6 +186,8 @@ static int cros_ec_led_probe_one(struct device *dev, struct cros_ec_device *cros
 						&priv->led_mc_cdev.led_cdev.max_brightness);
 	if (num_subleds < 0)
 		return num_subleds;
+	if (num_subleds == 0)
+		return 0; /* LED without any colors, skip */
 
 	priv->cros_ec = cros_ec;
 	priv->led_id = id;

---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251028-cros_ec-leds-no-colors-18eb8d1efa92

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

[STABLE BACKPORT] leds: leds-cros_ec: Skip LEDs without color components
Posted by Thomas Weißschuh 1 month, 3 weeks ago
Dear stable team,

please backport the following commit from Linus' tree to the relevant
stable trees.

	4dbf066d965c ("leds: leds-cros_ec: Skip LEDs without color components")

It fixes a probing issue affecting users as explained in the commit.


Regards,
Thomas
Re: (subset) [PATCH] leds: leds-cros_ec: Skip LEDs without color components
Posted by Lee Jones 3 months ago
On Tue, 28 Oct 2025 16:31:03 +0100, Thomas Weißschuh wrote:
> A user reports that on their Lenovo Corsola Magneton with EC firmware
> steelix-15194.270.0 the driver probe fails with EINVAL. It turns out
> that the power LED does not contain any color components as indicated
> by the following "ectool led power query" output:
> 
> Brightness range for LED 1:
>         red     : 0x0
>         green   : 0x0
>         blue    : 0x0
>         yellow  : 0x0
>         white   : 0x0
>         amber   : 0x0
> 
> [...]

Applied, thanks!

[1/1] leds: leds-cros_ec: Skip LEDs without color components
      commit: 4dbf066d965cd3299fb396f1375d10423c9c625c

--
Lee Jones [李琼斯]