[PATCH] led: Do not overwrite label

Marek Vasut marex at denx.de
Mon Oct 23 10:26:06 CEST 2023


On 10/23/23 10:21, Christian Gmeiner wrote:
> 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;

+CC Rasmus, you really do want to review this one.

There is existing and more extensive series from Rasmus addressing the 
same issue.


More information about the U-Boot mailing list