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

Simon Glass sjg at chromium.org
Wed Dec 7 17:17:59 CET 2011


Hi Heiko,

On Tue, Dec 6, 2011 at 11:16 PM, Heiko Schocher <hs at denx.de> wrote:
> 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?

[Well, since you asked, there are quite a few changes in this file,
and initially I was planning to split the changes into a number of
small commits for each file in common/. But there are a lot of files,
and I was unsure of the utility of the patch anyway, so I put the rest
in a single patch. But on the other hand, there would be no reason to
merge this and not the others I suppose]

I will squash this patch.

>
>> 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]

Thanks, will fix in next pass.

Regards,
Simon

>
> 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