linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] [MIPS] DEC:do not initialise statics to 0
       [not found] <4d4c0b64.993.180d7a6945a.Coremail.chenxuebing@jari.cn>
@ 2022-05-20 10:56 ` Maciej W. Rozycki
  0 siblings, 0 replies; only message in thread
From: Maciej W. Rozycki @ 2022-05-20 10:56 UTC (permalink / raw)
  To: 陈学兵; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-20 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4d4c0b64.993.180d7a6945a.Coremail.chenxuebing@jari.cn>
2022-05-20 10:56 ` [PATCH] [MIPS] DEC:do not initialise statics to 0 Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).