Just to sum up.

On 7/8/26 4:32 PM, Naveen Kumar Chaudhary wrote:
[...]
---
   cmd/led.c | 6 +++++-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/led.c b/cmd/led.c
index 296c07b3b38..d547276e480 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -27,7 +27,7 @@ enum led_state_t get_led_cmd(char *var)
               return i;
       }
-    return -1;
+    return LEDST_COUNT;
   }
   static int show_led_state(struct udevice *dev)
@@ -84,6 +84,10 @@ int do_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
           return list_leds();
       cmd = argc > 2 ? get_led_cmd(argv[2]) : LEDST_COUNT;
+    if (argc > 2 && cmd == LEDST_COUNT) {
+        printf("Unknown LED state '%s'\n", argv[2]);

Don't print on an invalid command. It's pretty clear what we support. We print when we don't find an LED because that's not a hardcoded string unlike on, off, toggle or blink and the user may have forgotten to enable some driver (or added the LED to the device tree).

With that change made (+ the Fixes: trailer added to the commit log as requested in my first mail),

Reviewed-by: Quentin Schulz <[email protected]>

Please send a v2 with that.

Thanks!
Quentin

Reply via email to