]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: i3c: fix list and current needing pre-selected controller
authorPranav Tilak <pranav.vinaytilak@amd.com>
Thu, 9 Jul 2026 09:12:53 +0000 (14:42 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 22 Jul 2026 19:10:17 +0000 (13:10 -0600)
The !currdev guard in do_i3c() was placed before the list and current
handlers, causing both to fail when no controller is pre-selected.
Move the guard to only protect device_list, write and read which
actually need a controller.

Fixes: b875409da737 ("cmd: Add i3c command support.")
Signed-off-by: Pranav Tilak <pranav.vinaytilak@amd.com>
Reviewed-by: Dinesh Maniyam <dinesh.maniyam@altera.com>
cmd/i3c.c

index 08957f4d447d3b9ef7791844e094a175376bb4e8..ba99a937990b2a5cde4b52e106a812565add90d5 100644 (file)
--- a/cmd/i3c.c
+++ b/cmd/i3c.c
@@ -240,16 +240,17 @@ static int do_i3c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        if (!is_i3c_subcommand(subcmd))
                return handle_i3c_select(subcmd);
 
+       if (!strcmp(subcmd, "list"))
+               return handle_i3c_list();
+       else if (!strcmp(subcmd, "current"))
+               return handle_i3c_current();
+
        if (!currdev) {
                printf("i3c: No I3C controller selected\n");
                return CMD_RET_FAILURE;
        }
 
-       if (!strcmp(subcmd, "list"))
-               return handle_i3c_list();
-       else if (!strcmp(subcmd, "current"))
-               return handle_i3c_current();
-       else if (!strcmp(subcmd, "device_list"))
+       if (!strcmp(subcmd, "device_list"))
                return handle_i3c_device_list();
        else if (!strcmp(subcmd, "write"))
                return handle_i3c_write(argc, argv);