lkml.org 
[lkml]   [2022]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] [MIPS] DEC:do not initialise statics to 0
On Wed, 18 May 2022, 陈学兵 wrote:

> ​Static variables do not need to be initialised to 0,

This is true.

> because compiler
> will initialise all uninitialised statics to 0.

This is however not (even though such zeroing is mandated by the C
language standard), because it is this code:

PTR_LA t0, __bss_start # clear .bss
LONG_S zero, (t0)
PTR_LA t1, __bss_stop - LONGSIZE
1:
PTR_ADDIU t0, LONGSIZE
LONG_S zero, (t0)
bne t0, t1, 1b

in arch/mips/kernel/head.S that does it in Linux (in userland code this
will be in CRT startup, but it's not a part of the compiler either). So
please avoid spreading misleading information in your change description.

> diff --git a/arch/mips/dec/prom/identify.c b/arch/mips/dec/prom/identify.c
> index 80cd14cd1a63..89e736670ccf 100644
> --- a/arch/mips/dec/prom/identify.c
> +++ b/arch/mips/dec/prom/identify.c
> @@ -45,7 +45,7 @@ const char *get_system_type(void)
> {
> #define STR_BUF_LEN 64
> static char system[STR_BUF_LEN];
> - static int called = 0;
> + static int called;

Barring the inaccuracy of the change description your code update is
correct, however your patch has been whitespace-damaged in transit and
cannot be applied as it stands.

Please send an updated version with the problems addressed.

NB the same concerns apply to your other such change submitted.

Maciej

\
 
 \ /
  Last update: 2022-05-20 12:56    [W:3.110 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site