All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pranav Tilak <pranav.vinaytilak@amd.com>
To: <u-boot@lists.denx.de>, <michal.simek@amd.com>
Cc: <git@amd.com>, <padmarao.begari@amd.com>,
	Pranav Tilak <pranav.vinaytilak@amd.com>,
	Dinesh Maniyam <dinesh.maniyam@altera.com>,
	"Tom Rini" <trini@konsulko.com>
Subject: [PATCH v2 2/4] cmd: i3c: fix list and current needing pre-selected controller
Date: Thu, 9 Jul 2026 14:42:53 +0530	[thread overview]
Message-ID: <20260709091357.1860417-3-pranav.vinaytilak@amd.com> (raw)
In-Reply-To: <20260709091357.1860417-1-pranav.vinaytilak@amd.com>

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 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/cmd/i3c.c b/cmd/i3c.c
index 08957f4d447..ba99a937990 100644
--- 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);
-- 
2.34.1


  parent reply	other threads:[~2026-07-09  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  9:12 [PATCH v2 0/4] i3c: dw: fix slave device setup and probe issues Pranav Tilak
2026-07-09  9:12 ` [PATCH v2 1/4] i3c: dw: make resets optional in probe Pranav Tilak
2026-07-22  2:51   ` Maniyam, Dinesh via U-Boot
2026-07-09  9:12 ` Pranav Tilak [this message]
2026-07-09  9:12 ` [PATCH v2 3/4] configs: versal2: enable I3C support Pranav Tilak
2026-07-09  9:12 ` [PATCH v2 4/4] i3c: dw: fix slave device setup after DAA Pranav Tilak
2026-07-22  3:54   ` Maniyam, Dinesh via U-Boot
2026-07-21  8:07 ` [PATCH v2 0/4] i3c: dw: fix slave device setup and probe issues Michal Simek via U-Boot
2026-07-22  3:56   ` Maniyam, Dinesh via U-Boot
2026-07-22  5:30     ` Michal Simek via U-Boot
2026-07-22 16:19       ` Tom Rini via U-Boot
2026-07-22 20:27 ` Tom Rini via U-Boot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709091357.1860417-3-pranav.vinaytilak@amd.com \
    --to=pranav.vinaytilak@amd.com \
    --cc=dinesh.maniyam@altera.com \
    --cc=git@amd.com \
    --cc=michal.simek@amd.com \
    --cc=padmarao.begari@amd.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.