Skip to content

Commit 20dbf4d

Browse files
Chenhongrenaescolar
authored andcommitted
drivers: i3c: shell: fix the judgement/argc count for getstatus/ibi tir
The errno for format 2 of the getstatus ccc always returns an error. The check for the invalid defining byte should use the "AND" operation instead of "OR." Additionally, the first byte of the ibi tir sending request is ignored due to the incorrect argument count. This commit fixes both issues. Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
1 parent 373771c commit 20dbf4d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/i3c/i3c_shell.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ static int cmd_i3c_ccc_getstatus(const struct shell *sh, size_t argc, char **arg
14301430
if (argc > 3) {
14311431
fmt = GETSTATUS_FORMAT_2;
14321432
defbyte = strtol(argv[3], NULL, 16);
1433-
if (defbyte != GETSTATUS_FORMAT_2_TGTSTAT || defbyte != GETSTATUS_FORMAT_2_PRECR) {
1433+
if (defbyte != GETSTATUS_FORMAT_2_TGTSTAT && defbyte != GETSTATUS_FORMAT_2_PRECR) {
14341434
shell_error(sh, "Invalid defining byte.");
14351435
return -EINVAL;
14361436
}
@@ -2075,9 +2075,9 @@ static int cmd_i3c_ibi_tir(const struct shell *sh, size_t argc, char **argv)
20752075
return -ENODEV;
20762076
}
20772077

2078-
data_length = argc - 3;
2078+
data_length = argc - 2;
20792079
for (i = 0; i < data_length; i++) {
2080-
buf[i] = (uint8_t)strtol(argv[3 + i], NULL, 16);
2080+
buf[i] = (uint8_t)strtol(argv[2 + i], NULL, 16);
20812081
}
20822082

20832083
request.ibi_type = I3C_IBI_TARGET_INTR;

0 commit comments

Comments
 (0)