[U-Boot] [PATCH 09/10] Use CMD_RET_usage in i2c

Heiko Schocher hs at denx.de
Wed Dec 7 08:16:34 CET 2011


Hello Simon,

Simon Glass wrote:
> This small patch converts the I2C command over to using the
> CMD_RET_USAGE return value instead of calling cmd_usage()
> directly.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>  common/cmd_i2c.c |   36 +++++++++++++++++++-----------------
>  1 files changed, 19 insertions(+), 17 deletions(-)

First, why did you seperate the changes in cmd_i2c.c from
the other same changes in your "Convert cmd_usage() calls in
common to use a	return value" patch? Is there a special reason
for this?

> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
> index e795139..165f1f2 100644
> --- a/common/cmd_i2c.c
> +++ b/common/cmd_i2c.c
[...]
> @@ -1208,7 +1208,9 @@ static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
>  			device = device->next;
>  		}
>  	} else {
> -		(void)i2c_mux_ident_muxstring ((uchar *)argv[1]);
> +		I2C_MUX_DEVICE *dev;
> +
> +		dev = i2c_mux_ident_muxstring((uchar *)argv[1]);

No, this will result in this warning:

    cmd_i2c.c: In function 'do_i2c_add_bus':
    cmd_i2c.c:1212:19: warning: variable 'dev' set but not used
    [-Wunused-but-set-variable]

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


More information about the U-Boot mailing list