checkpatch nits ...

Sean MacLennan smaclennan at pikatech.com
Sat Aug 23 10:40:49 EST 2008


On Fri, 22 Aug 2008 17:21:44 -0700
"Kevin Diggs" <kevdig at hypersurf.com> wrote:

> Hi,
> 
> Can I ignore these checkpatch errors:
> 
> ERROR: do not initialise statics to 0 or NULL
> #829: FILE: powerpc/kernel/cpu/pll_if.c:61:
> +static unsigned int override_bus_clock = 0;
> 
> ERROR: do not initialise externals to 0 or NULL
> #1281: FILE: powerpc/kernel/cpu/pll_if.c:513:
> +int rval = 0;
> 
> Someone (Arnd?) told me this was due to an older compiler putting
> these in a strange section?

Older gcc, and in fact many (most?) compilers, put *all* initialized
variables in a data section rather than the bss. This means they took
up room in the executable. By not explicitly setting them to zero, they
where put in the bss and initialized to zero anyway.

Newer gccs will put them in the bss if they are zero. You could argue
that this is technically wrong.

I tend to remove the 0s or nulls just to cut down on the checkpatch
errors. You need to decide if it is worth it. I wouldn't submit a patch
with *just* these changes.

Cheers,
   Sean



More information about the Linuxppc-dev mailing list