Skip to contentSkip to conversation

cmd_usb.c: show cmd usage if no args given

PATCH New Serge Ziryukin 2 participants 2 messages Apr 25, 2010 – May 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd_usb.c: show cmd usage if no args given

---
 common/cmd_usb.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
common/cmd_usb.c +5 -0
index ee3755c..fcb5f76 100644
@@ -516,6 +516,11 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	block_dev_desc_t *stor_dev;
 #endif
 
+	if (argc < 2) {
+		cmd_usage(cmdtp);
+		return 1;
+	}
+
 	if ((strncmp(argv[1], "reset", 5) == 0) ||
 		 (strncmp(argv[1], "start", 5) == 0)) {
 		usb_stop();
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 cmd_usb.c: show cmd usage if no args given

Dear Serge Ziryukin,

Quoted 4 lines · In message <[email protected]> you wrote:
---
 common/cmd_usb.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied.

Note that the old code already printed a usage message when called without arguments, but only after USB had been started, so your code is indeed an improvement. Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a program is being  tested,  it  is  too  late  to  make  design
changes.                  -- Geoffrey James, "The Tao of Programming"