Skip to contentSkip to conversation

Apply ccc35ff2fd2911986b716a87fe65e03fac2312c9 to 5.15, 6.1, and 6.6

PATCH Nathan Chancellor 2 participants 2 messages Dec 4, 2025 – Dec 7, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

drivers/leds/leds-spi-byte.c +1 -1
index 82696e0607a5..7dd876df8b36 100644
@@ -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")) {

From 45fa848142bf47813b7b08679f28f2ddc6b3ad82 Mon Sep 17 00:00:00 2001
From: Stefan Kalscheuer <[email protected]>
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.

---
 drivers/leds/leds-spi-byte.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/leds/leds-spi-byte.c +6 -5
index 6883d3ba382f..eb6481df5997 100644
@@ -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

Signature · 1 line
2.52.0
maintainer
#1 lore raw
Quoted 15 lines · Nathan Chancellor

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
Quoted 4 lines

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.

Signature · 2 lines
Thanks,
Sasha