[PATCH] led: Do not overwrite label

Christian Gmeiner christian.gmeiner at gmail.com
Mon Oct 23 10:21:17 CEST 2023


label might have been set by a non device-tree based U-Boot driver already.

In my concrete case there is a PCI driver that uses device_bind_driver(..)
for different class types. The UCLASS_LED specific driver sets label
in its bind function.

Without this change the LEDs exposed by the PCI device are not available.

Fixes: 83c63f0d11 ("led: Move OF "label" property parsing to core")
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 drivers/led/led-uclass.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 68ca3c2970..aebdfdeb95 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -71,9 +71,10 @@ static int led_post_bind(struct udevice *dev)
 	struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
 	const char *default_state;
 
-	uc_plat->label = dev_read_string(dev, "label");
 	if (!uc_plat->label)
-		uc_plat->label = ofnode_get_name(dev_ofnode(dev));
+		uc_plat->label = dev_read_string(dev, "label");
+		if (!uc_plat->label)
+			uc_plat->label = ofnode_get_name(dev_ofnode(dev));
 
 	uc_plat->default_state = LEDST_COUNT;
 
-- 
2.41.0



More information about the U-Boot mailing list