[PATCH v4 4/9] led: status_led: add warning when an invalid Status LED ID is used

Peter Robinson pbrobinson at gmail.com
Thu Jun 20 19:31:12 CEST 2024


On Thu, 20 Jun 2024 at 02:51, Christian Marangi <ansuelsmth at gmail.com> wrote:
>
> Add a warning when an invalid Status LED ID is used to make the user
> aware of bad configurations.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
> ---
>  drivers/misc/status_led.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c
> index 2b904bfa9c2..7912b4a9448 100644
> --- a/drivers/misc/status_led.c
> +++ b/drivers/misc/status_led.c
> @@ -105,8 +105,10 @@ void status_led_tick(ulong timestamp)
>
>  static led_dev_t *status_get_led_dev(int led)
>  {
> -       if (led < 0 || led >= MAX_LED_DEV)
> +       if (led < 0 || led >= MAX_LED_DEV) {
> +               printf("Invalid Status LED ID %d.", led);

I think this needs a \n to ensure what ever the next message is it
will be on a new line.

>                 return NULL;
> +       }
>
>         if (!status_led_init_done)
>                 status_led_init();
> --
> 2.43.0
>


More information about the U-Boot mailing list