Re: [PATCH] [MIPS] DEC:do not initialise statics to 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux