[U-Boot] [PATCH 2/8] net/net.c: cosmetic: variable initializations

Mike Frysinger vapier at gentoo.org
Thu May 5 09:54:12 CEST 2011


On Wed, May 4, 2011 at 12:42, Luca Ceresoli wrote:
> Mike Frysinger wrote:
>> On Wed, May 4, 2011 at 08:40, Luca Ceresoli wrote:
>>>
>>>  - ERROR: that open brace { should be on the previous line
>>> ...
>>> -uchar          NetCDPAddr[6] =
>>> -                       { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
>>> +uchar          NetCDPAddr[6] = {
>>> +                       0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
>>> ...
>>
>> your fix here is worse than the original.  just leave them be.
>
> Damn, you're right!
>
> I think a one-line solution would be even better (and much simpler):
>
> uchar           NetCDPAddr[6] = {0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc};

i agree

> BTW, this is the original checkpatch message:
>  ERROR: that open brace { should be on the previous line
>  #172: FILE: net.c:172:
>  +uchar          NetCDPAddr[6] =
>  +                       { 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
>
> So either we choose the one-line solution above, or we have the first
> checkpatch message that should be disabled in the U-Boot version, when it
> will exist.

sometimes it does warn when people do things wrongly, but this is once
again why i advocate people reviewing the output and not acting like a
robot.

i cant check checkpatch atm to see how it reacts, but these are
acceptable in my mind:
uchar foo[] = { 0, 1, 2, 3, };
uchar foo[] =
    { 0, 1, 2, 3, };
uchar foo[] = {
    0, 1, 2, 3,
};

the form you used though is certainly wrong (even if checkpatch didnt say so):
uchar foo[] = {
    0, 1, 2, 3, };
-mike


More information about the U-Boot mailing list