public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC][PATCH 08/19] i2c: fix command usage help
@ 2010-07-29 10:44 Heiko Schocher
  2010-07-29 15:40 ` Peter Tyser
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2010-07-29 10:44 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Heiko Schocher <hs@denx.de>
---
 common/cmd_i2c.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index a1a84a1..91e60ae 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1297,6 +1297,11 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *c;

+	if (argc < 2) {
+		cmd_usage(cmdtp);
+		return 1;
+	}
+
 	/* Strip off leading 'i2c' command argument */
 	argc--;
 	argv++;
-- 
1.6.2.5

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [RFC][PATCH 08/19] i2c: fix command usage help
  2010-07-29 10:44 [U-Boot] [RFC][PATCH 08/19] i2c: fix command usage help Heiko Schocher
@ 2010-07-29 15:40 ` Peter Tyser
  2010-07-30  6:04   ` Heiko Schocher
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Tyser @ 2010-07-29 15:40 UTC (permalink / raw)
  To: u-boot

>  {
>  	cmd_tbl_t *c;
> 
> +	if (argc < 2) {
> +		cmd_usage(cmdtp);
> +		return 1;
> +	}
> +

Wolfgang recently made cmd_usage() return 1 so the above could be
simplified to:
if (argc < 2)
	return cmd_usage(cmdtp);

Best,
Peter

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

* [U-Boot] [RFC][PATCH 08/19] i2c: fix command usage help
  2010-07-29 15:40 ` Peter Tyser
@ 2010-07-30  6:04   ` Heiko Schocher
  2010-08-03 10:15     ` [U-Boot] [RFC][PATCH v2 " Heiko Schocher
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2010-07-30  6:04 UTC (permalink / raw)
  To: u-boot

Hello Peter,

Peter Tyser wrote:
>>  {
>>  	cmd_tbl_t *c;
>>
>> +	if (argc < 2) {
>> +		cmd_usage(cmdtp);
>> +		return 1;
>> +	}
>> +
> 
> Wolfgang recently made cmd_usage() return 1 so the above could be
> simplified to:
> if (argc < 2)
> 	return cmd_usage(cmdtp);

Hups, missed this, sorry. I fix it in the next version. thanks.

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [RFC][PATCH v2 08/19] i2c: fix command usage help
  2010-07-30  6:04   ` Heiko Schocher
@ 2010-08-03 10:15     ` Heiko Schocher
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2010-08-03 10:15 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Heiko Schocher <hs@denx.de>
---
- changes since v1
  added comment from Peter Tyser
  - simplified this patch as cmd_usage() returns 1

 common/cmd_i2c.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index a1a84a1..48de54b 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1297,6 +1297,9 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *c;

+	if (argc < 2)
+		return cmd_usage(cmdtp);
+
 	/* Strip off leading 'i2c' command argument */
 	argc--;
 	argv++;
-- 
1.6.2.5

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

end of thread, other threads:[~2010-08-03 10:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 10:44 [U-Boot] [RFC][PATCH 08/19] i2c: fix command usage help Heiko Schocher
2010-07-29 15:40 ` Peter Tyser
2010-07-30  6:04   ` Heiko Schocher
2010-08-03 10:15     ` [U-Boot] [RFC][PATCH v2 " Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox