* Apply ccc35ff2fd2911986b716a87fe65e03fac2312c9 to 5.15, 6.1, and 6.6
@ 2025-12-04 0:00 Nathan Chancellor
2025-12-07 0:37 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-12-04 0:00 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: stable, Lee Jones, Pavel Machek, linux-leds, Stefan Kalscheuer
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
Hi stable folks,
Please apply commit ccc35ff2fd29 ("leds: spi-byte: Use
devm_led_classdev_register_ext()") to 5.15, 6.1, and 6.6. It
inadvertently addresses an instance of -Wuninitialized visible with
clang-21 and newer:
drivers/leds/leds-spi-byte.c:99:26: error: variable 'child' is uninitialized when used here [-Werror,-Wuninitialized]
99 | of_property_read_string(child, "label", &name);
| ^~~~~
drivers/leds/leds-spi-byte.c:83:27: note: initialize the variable 'child' to silence this warning
83 | struct device_node *child;
| ^
| = NULL
It applies cleanly to 6.6. I have attached a backport for 6.1 and 5.15,
which can be generated locally with:
$ git format-patch -1 --stdout ccc35ff2fd2911986b716a87fe65e03fac2312c9 | sed 's;strscpy;strlcpy;' | patch -p1
This change seems safe to me but if I am missing a massive dependency
chain, an alternative would be moving child's initialization up in these
stable branches.
Cheers,
Nathan
diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c
index 82696e0607a5..7dd876df8b36 100644
--- a/drivers/leds/leds-spi-byte.c
+++ b/drivers/leds/leds-spi-byte.c
@@ -96,6 +96,7 @@ static int spi_byte_probe(struct spi_device *spi)
if (!led)
return -ENOMEM;
+ child = of_get_next_available_child(dev_of_node(dev), NULL);
of_property_read_string(child, "label", &name);
strlcpy(led->name, name, sizeof(led->name));
led->spi = spi;
@@ -106,7 +107,6 @@ static int spi_byte_probe(struct spi_device *spi)
led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value;
led->ldev.brightness_set_blocking = spi_byte_brightness_set_blocking;
- child = of_get_next_available_child(dev_of_node(dev), NULL);
state = of_get_property(child, "default-state", NULL);
if (state) {
if (!strcmp(state, "on")) {
[-- Attachment #2: ccc35ff2fd2911986b716a87fe65e03fac2312c9-5.15-6.1.patch --]
[-- Type: text/plain, Size: 2319 bytes --]
From 45fa848142bf47813b7b08679f28f2ddc6b3ad82 Mon Sep 17 00:00:00 2001
From: Stefan Kalscheuer <stefan@stklcode.de>
Date: Sun, 4 Feb 2024 16:07:26 +0100
Subject: [PATCH 5.15 and 6.1] leds: spi-byte: Use
devm_led_classdev_register_ext()
commit ccc35ff2fd2911986b716a87fe65e03fac2312c9 upstream.
Use extended classdev registration to generate generic device names from
color and function enums instead of reading only the label from the
device tree.
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
Link: https://lore.kernel.org/r/20240204150726.29783-1-stefan@stklcode.de
Signed-off-by: Lee Jones <lee@kernel.org>
[nathan: Fix conflict due to lack of bf4a35e9201d]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/leds/leds-spi-byte.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c
index 6883d3ba382f..eb6481df5997 100644
--- a/drivers/leds/leds-spi-byte.c
+++ b/drivers/leds/leds-spi-byte.c
@@ -83,7 +83,7 @@ static int spi_byte_probe(struct spi_device *spi)
struct device_node *child;
struct device *dev = &spi->dev;
struct spi_byte_led *led;
- const char *name = "leds-spi-byte::";
+ struct led_init_data init_data = {};
const char *state;
int ret;
@@ -96,12 +96,9 @@ static int spi_byte_probe(struct spi_device *spi)
if (!led)
return -ENOMEM;
- of_property_read_string(child, "label", &name);
- strlcpy(led->name, name, sizeof(led->name));
led->spi = spi;
mutex_init(&led->mutex);
led->cdef = device_get_match_data(dev);
- led->ldev.name = led->name;
led->ldev.brightness = LED_OFF;
led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value;
led->ldev.brightness_set_blocking = spi_byte_brightness_set_blocking;
@@ -121,7 +118,11 @@ static int spi_byte_probe(struct spi_device *spi)
spi_byte_brightness_set_blocking(&led->ldev,
led->ldev.brightness);
- ret = devm_led_classdev_register(&spi->dev, &led->ldev);
+ init_data.fwnode = of_fwnode_handle(child);
+ init_data.devicename = "leds-spi-byte";
+ init_data.default_label = ":";
+
+ ret = devm_led_classdev_register_ext(&spi->dev, &led->ldev, &init_data);
if (ret) {
of_node_put(child);
mutex_destroy(&led->mutex);
base-commit: f6e38ae624cf7eb96fb444a8ca2d07caa8d9c8fe
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Apply ccc35ff2fd2911986b716a87fe65e03fac2312c9 to 5.15, 6.1, and 6.6
2025-12-04 0:00 Apply ccc35ff2fd2911986b716a87fe65e03fac2312c9 to 5.15, 6.1, and 6.6 Nathan Chancellor
@ 2025-12-07 0:37 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2025-12-07 0:37 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Greg Kroah-Hartman, stable, Lee Jones, Pavel Machek, linux-leds,
Stefan Kalscheuer
On Wed, Dec 03, 2025 at 05:00:25PM -0700, Nathan Chancellor wrote:
>Hi stable folks,
>
>Please apply commit ccc35ff2fd29 ("leds: spi-byte: Use
>devm_led_classdev_register_ext()") to 5.15, 6.1, and 6.6. It
>inadvertently addresses an instance of -Wuninitialized visible with
>clang-21 and newer:
>
> drivers/leds/leds-spi-byte.c:99:26: error: variable 'child' is uninitialized when used here [-Werror,-Wuninitialized]
> 99 | of_property_read_string(child, "label", &name);
> | ^~~~~
> drivers/leds/leds-spi-byte.c:83:27: note: initialize the variable 'child' to silence this warning
> 83 | struct device_node *child;
> | ^
> | = NULL
>
>It applies cleanly to 6.6. I have attached a backport for 6.1 and 5.15,
>which can be generated locally with:
>
> $ git format-patch -1 --stdout ccc35ff2fd2911986b716a87fe65e03fac2312c9 | sed 's;strscpy;strlcpy;' | patch -p1
Queued up. I just picked up the dependency instead of changing the patch.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-07 0:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 0:00 Apply ccc35ff2fd2911986b716a87fe65e03fac2312c9 to 5.15, 6.1, and 6.6 Nathan Chancellor
2025-12-07 0:37 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).