All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: tools: no need to initialise statics to 0
@ 2022-05-08  2:31 Jason Wang
  2022-05-12 16:09 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2022-05-08  2:31 UTC (permalink / raw)
  To: tsbogend; +Cc: wangborong, linux-mips, linux-kernel

Static variables do not need to be initialised to 0, because compiler
will initialise all uninitialised statics to 0. Thus, remove the
unneeded initializations.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
---
 arch/mips/boot/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/boot/tools/relocs.c b/arch/mips/boot/tools/relocs.c
index 1bf53f3524b3..02fc85f3e8ff 100644
--- a/arch/mips/boot/tools/relocs.c
+++ b/arch/mips/boot/tools/relocs.c
@@ -351,7 +351,7 @@ static void read_symtabs(FILE *fp)
 
 static void read_relocs(FILE *fp)
 {
-	static unsigned long base = 0;
+	static unsigned long base;
 	int i, j;
 
 	if (!base) {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: tools: no need to initialise statics to 0
  2022-05-08  2:31 [PATCH] MIPS: tools: no need to initialise statics to 0 Jason Wang
@ 2022-05-12 16:09 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-05-12 16:09 UTC (permalink / raw)
  To: Jason Wang; +Cc: linux-mips, linux-kernel

On Sun, May 08, 2022 at 10:31:46AM +0800, Jason Wang wrote:
> Static variables do not need to be initialised to 0, because compiler
> will initialise all uninitialised statics to 0. Thus, remove the
> unneeded initializations.
> 
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
>  arch/mips/boot/tools/relocs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/boot/tools/relocs.c b/arch/mips/boot/tools/relocs.c
> index 1bf53f3524b3..02fc85f3e8ff 100644
> --- a/arch/mips/boot/tools/relocs.c
> +++ b/arch/mips/boot/tools/relocs.c
> @@ -351,7 +351,7 @@ static void read_symtabs(FILE *fp)
>  
>  static void read_relocs(FILE *fp)
>  {
> -	static unsigned long base = 0;
> +	static unsigned long base;
>  	int i, j;
>  
>  	if (!base) {
> -- 
> 2.35.1

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-12 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08  2:31 [PATCH] MIPS: tools: no need to initialise statics to 0 Jason Wang
2022-05-12 16:09 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.