All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: spi: Judge the number of added parameters
@ 2022-12-06  9:24 chenzhipeng
  2022-12-07  1:08 ` Simon Glass
  2023-01-13  0:16 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: chenzhipeng @ 2022-12-06  9:24 UTC (permalink / raw)
  To: patrice.chotard; +Cc: u-boot, chenzhipeng

When only sspi is entered, help information can be printed.

Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
---
 cmd/spi.c | 3 +++
 1 file changed, 3 insertions(+)

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cmd: spi: Judge the number of added parameters
  2022-12-06  9:24 [PATCH] cmd: spi: Judge the number of added parameters chenzhipeng
@ 2022-12-07  1:08 ` Simon Glass
  2023-01-13  0:16 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-12-07  1:08 UTC (permalink / raw)
  To: chenzhipeng; +Cc: patrice.chotard, u-boot

On Wed, 7 Dec 2022 at 03:50, chenzhipeng <chenzhipeng@eswincomputing.com> wrote:
>
> When only sspi is entered, help information can be printed.
>
> Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
> ---
>  cmd/spi.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>



> 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);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cmd: spi: Judge the number of added parameters
  2022-12-06  9:24 [PATCH] cmd: spi: Judge the number of added parameters chenzhipeng
  2022-12-07  1:08 ` Simon Glass
@ 2023-01-13  0:16 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-01-13  0:16 UTC (permalink / raw)
  To: chenzhipeng; +Cc: patrice.chotard, u-boot

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

On Tue, Dec 06, 2022 at 05:24:38PM +0800, chenzhipeng wrote:

> When only sspi is entered, help information can be printed.
> 
> Signed-off-by: chenzhipeng <chenzhipeng@eswincomputing.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-13  0:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06  9:24 [PATCH] cmd: spi: Judge the number of added parameters chenzhipeng
2022-12-07  1:08 ` Simon Glass
2023-01-13  0:16 ` Tom Rini

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.