* [PATCH 1/3] leds: class: Fix the LED name in the debug message after registering
2026-11-28 21:52 [PATCH 0/3] leds: Fix "(null)" LED names after registering Carlo Szelinsky
@ 2026-11-28 21:52 ` Carlo Szelinsky
2026-11-28 21:56 ` sashiko-bot
2026-11-28 21:52 ` [PATCH 2/3] leds: syscon: Remove the probe message Carlo Szelinsky
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Carlo Szelinsky @ 2026-11-28 21:52 UTC (permalink / raw)
To: Lee Jones, Pavel Machek
Cc: Griffin Kroah-Hartman, Marek Behún,
Álvaro Fernández Rojas, linux-leds, linux-kernel
When a driver passes init_data, led_classdev_register_ext() builds the
LED name in a local buffer and does not set led_cdev->name. Drivers
that use init_data usually leave it unset. The debug message at the
end still prints led_cdev->name, so it says
"Registered led device: (null)".
Print the name of the LED device instead.
Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names")
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
---
drivers/leds/led-class.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 00be3cb96c00..23d692035150 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -586,7 +586,7 @@ int led_classdev_register_ext(struct device *parent,
mutex_unlock(&led_cdev->led_access);
dev_dbg(parent, "Registered led device: %s\n",
- led_cdev->name);
+ dev_name(led_cdev->dev));
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/3] leds: class: Fix the LED name in the debug message after registering
2026-11-28 21:52 ` [PATCH 1/3] leds: class: Fix the LED name in the debug message " Carlo Szelinsky
@ 2026-11-28 21:56 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-28 21:56 UTC (permalink / raw)
To: Carlo Szelinsky; +Cc: linux-leds, lee
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] leds: uninitialized rwsem race in led_trigger_read() [1]
--
commit 49db16c343f5b4c3b48a74345ac2e46cd2c2cac1
Author: Carlo Szelinsky <github@szelinsky.de>
leds: class: Fix the LED name in the debug message after registering
This commit updates the registration debug message in
led_classdev_register_ext() to print dev_name(led_cdev->dev) instead of
led_cdev->name, which is unset when init_data is used.
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 00be3cb96c00f..23d692035150f 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -586,7 +586,7 @@ int led_classdev_register_ext(struct device *parent,
> mutex_unlock(&led_cdev->led_access);
[Severity: Critical]
This problem wasn't introduced by this patch, but can led_trigger_read()
call down_read() on led_cdev->trigger_lock before it is initialized [1]?
In led_classdev_register_ext(), device_create_with_groups() exposes the
trigger sysfs attribute before init_rwsem(&led_cdev->trigger_lock) runs.
Unlike other sysfs callbacks, led_trigger_read() does not acquire
led_cdev->led_access:
CPU0 CPU1
led_classdev_register_ext()
mutex_lock(&led_cdev->led_access)
device_create_with_groups(...)
led_trigger_read()
down_read(&led_cdev->trigger_lock)
<-- uninitialized rw_semaphore
init_rwsem(&led_cdev->trigger_lock)
A concurrent read of the trigger sysfs file during registration operates on
an uninitialized rw_semaphore, corrupting lock state and crashing the
kernel.
[1] https://sashiko.dev/#/bug/linux-376c7db5-ddc1-4faa-9f5b-43d2d3b7cb0d
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261128215230.66205-1-github@szelinsky.de?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] leds: syscon: Remove the probe message
2026-11-28 21:52 [PATCH 0/3] leds: Fix "(null)" LED names after registering Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 1/3] leds: class: Fix the LED name in the debug message " Carlo Szelinsky
@ 2026-11-28 21:52 ` Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 3/3] leds: bcm6328, bcm6358: Remove the registration debug message Carlo Szelinsky
2026-11-28 21:56 ` [PATCH 0/3] leds: Fix "(null)" LED names after registering sashiko-bot
3 siblings, 0 replies; 6+ messages in thread
From: Carlo Szelinsky @ 2026-11-28 21:52 UTC (permalink / raw)
To: Lee Jones, Pavel Machek
Cc: Griffin Kroah-Hartman, Marek Behún,
Álvaro Fernández Rojas, linux-leds, linux-kernel
The probe message prints cdev.name. Since the driver registers with
devm_led_classdev_register_ext(), it no longer sets cdev.name, so the
message says "registered LED (null)" for every LED.
The LED core prints a similar debug message for the same device after
it registers the LED, and with the previous patch it shows the right
name. Remove the message instead of fixing it.
Fixes: 006631969880 ("leds: syscon: use struct led_init_data when registering")
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
---
drivers/leds/leds-syscon.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/leds/leds-syscon.c b/drivers/leds/leds-syscon.c
index 50603bb70b70..6f7b59631ce4 100644
--- a/drivers/leds/leds-syscon.c
+++ b/drivers/leds/leds-syscon.c
@@ -115,7 +115,6 @@ static int syscon_led_probe(struct platform_device *pdev)
return ret;
platform_set_drvdata(pdev, sled);
- dev_info(dev, "registered LED %s\n", sled->cdev.name);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] leds: bcm6328, bcm6358: Remove the registration debug message
2026-11-28 21:52 [PATCH 0/3] leds: Fix "(null)" LED names after registering Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 1/3] leds: class: Fix the LED name in the debug message " Carlo Szelinsky
2026-11-28 21:52 ` [PATCH 2/3] leds: syscon: Remove the probe message Carlo Szelinsky
@ 2026-11-28 21:52 ` Carlo Szelinsky
2026-11-28 21:56 ` [PATCH 0/3] leds: Fix "(null)" LED names after registering sashiko-bot
3 siblings, 0 replies; 6+ messages in thread
From: Carlo Szelinsky @ 2026-11-28 21:52 UTC (permalink / raw)
To: Lee Jones, Pavel Machek
Cc: Griffin Kroah-Hartman, Marek Behún,
Álvaro Fernández Rojas, linux-leds, linux-kernel
The debug message prints cdev.name. Since the drivers register with
devm_led_classdev_register_ext(), they no longer set cdev.name, so the
message says "registered LED (null)" for every LED.
The LED core prints a similar debug message for the same device after
it registers the LED, and with the first patch of this series it shows
the right name. Remove the message instead of fixing it.
Fixes: e4e912a349b2 ("leds: bcm6328, bcm6358: use struct led_init_data when registering")
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
---
drivers/leds/leds-bcm6328.c | 2 --
drivers/leds/leds-bcm6358.c | 2 --
2 files changed, 4 deletions(-)
diff --git a/drivers/leds/leds-bcm6328.c b/drivers/leds/leds-bcm6328.c
index 667ff31eb8fa..2d03715d3fb5 100644
--- a/drivers/leds/leds-bcm6328.c
+++ b/drivers/leds/leds-bcm6328.c
@@ -383,8 +383,6 @@ static int bcm6328_led(struct device *dev, struct device_node *nc, u32 reg,
if (rc < 0)
return rc;
- dev_dbg(dev, "registered LED %s\n", led->cdev.name);
-
return 0;
}
diff --git a/drivers/leds/leds-bcm6358.c b/drivers/leds/leds-bcm6358.c
index ab15c591386c..7876423b0d0f 100644
--- a/drivers/leds/leds-bcm6358.c
+++ b/drivers/leds/leds-bcm6358.c
@@ -138,8 +138,6 @@ static int bcm6358_led(struct device *dev, struct device_node *nc, u32 reg,
if (rc < 0)
return rc;
- dev_dbg(dev, "registered LED %s\n", led->cdev.name);
-
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/3] leds: Fix "(null)" LED names after registering
2026-11-28 21:52 [PATCH 0/3] leds: Fix "(null)" LED names after registering Carlo Szelinsky
` (2 preceding siblings ...)
2026-11-28 21:52 ` [PATCH 3/3] leds: bcm6328, bcm6358: Remove the registration debug message Carlo Szelinsky
@ 2026-11-28 21:56 ` sashiko-bot
3 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-28 21:56 UTC (permalink / raw)
To: Carlo Szelinsky; +Cc: linux-leds, lee
Sashiko has finished reviewing this 3-patch series:
- Patches 2 and 3: no issues found.
- Patch 1 ("leds: class: Fix the LED name in the debug message a..."): 1
related pre-existing bug noted
A detailed review has been sent as a separate reply to patch 1.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261128215230.66205-1-github@szelinsky.de
^ permalink raw reply [flat|nested] 6+ messages in thread