From: chenzhipeng Date: Tue, 6 Dec 2022 09:24:38 +0000 (+0800) Subject: cmd: spi: Judge the number of added parameters X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=c40e021b83d9db9aec736a0cb992fd84d2e63c02;p=u-boot.git cmd: spi: Judge the number of added parameters When only sspi is entered, help information can be printed. Signed-off-by: chenzhipeng Reviewed-by: Simon Glass --- diff --git a/cmd/spi.c b/cmd/spi.c index 454ebe37d7..f30018f33b 100644 --- a/cmd/spi.c +++ b/cmd/spi.c @@ -112,6 +112,9 @@ int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if ((flag & CMD_FLAG_REPEAT) == 0) { + if (argc < 2) + return CMD_RET_USAGE; + if (argc >= 2) { mode = CONFIG_DEFAULT_SPI_MODE; bus = dectoul(argv[1], &cp);