Skip to content

Commit c40e021

Browse files
chenzhipengtrini
chenzhipeng
authored andcommitted
cmd: spi: Judge the number of added parameters
When only sspi is entered, help information can be printed. Signed-off-by: chenzhipeng <[email protected]> Reviewed-by: Simon Glass <[email protected]>
1 parent 33965c7 commit c40e021

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/spi.c

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
112112

113113
if ((flag & CMD_FLAG_REPEAT) == 0)
114114
{
115+
if (argc < 2)
116+
return CMD_RET_USAGE;
117+
115118
if (argc >= 2) {
116119
mode = CONFIG_DEFAULT_SPI_MODE;
117120
bus = dectoul(argv[1], &cp);

0 commit comments

Comments
 (0)