* [U-Boot] [PATCH] CMD_I2C: make alen=0 work
@ 2010-08-25 12:41 Reinhard Meyer
2010-08-26 6:35 ` Heiko Schocher
0 siblings, 1 reply; 2+ messages in thread
From: Reinhard Meyer @ 2010-08-25 12:41 UTC (permalink / raw)
To: u-boot
Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
---
common/cmd_i2c.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 371e022..1283c82 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -152,7 +152,7 @@ int i2c_set_bus_speed(unsigned int)
/*
* get_alen: small parser helper function to get address length
- * returns the address length,or 0 on error
+ * returns the address length
*/
static uint get_alen(char *arg)
{
@@ -163,9 +163,6 @@ static uint get_alen(char *arg)
for (j = 0; j < 8; j++) {
if (arg[j] == '.') {
alen = arg[j+1] - '0';
- if (alen > 3) {
- return 0;
- }
break;
} else if (arg[j] == '\0')
break;
@@ -198,7 +195,7 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
*/
devaddr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -255,7 +252,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -337,7 +334,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -399,7 +396,7 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
@@ -477,7 +474,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
}
@@ -621,7 +618,7 @@ static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
*/
addr = simple_strtoul(argv[2], NULL, 16);
alen = get_alen(argv[2]);
- if (alen == 0)
+ if (alen > 3)
return cmd_usage(cmdtp);
/*
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] CMD_I2C: make alen=0 work
2010-08-25 12:41 [U-Boot] [PATCH] CMD_I2C: make alen=0 work Reinhard Meyer
@ 2010-08-26 6:35 ` Heiko Schocher
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Schocher @ 2010-08-26 6:35 UTC (permalink / raw)
To: u-boot
Hello Reinhard,
Reinhard Meyer wrote:
> Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
> ---
> common/cmd_i2c.c | 17 +++++++----------
> 1 files changed, 7 insertions(+), 10 deletions(-)
Thanks for detecting this.
Applied to u-boot-i2c.git
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] 2+ messages in thread
end of thread, other threads:[~2010-08-26 6:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 12:41 [U-Boot] [PATCH] CMD_I2C: make alen=0 work Reinhard Meyer
2010-08-26 6:35 ` Heiko Schocher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox