2022-05-09 11:13:41

by Jason Wang

[permalink] [raw]
Subject: [PATCH] xtensa: no need to initialise statics to 0

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 <[email protected]>
---
arch/xtensa/platforms/xt2000/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
index 145d129be76f..0dc22c371614 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -78,7 +78,7 @@ void __init platform_init(bp_tag_t *first)

void platform_heartbeat(void)
{
- static int i=0, t = 0;
+ static int i, t;

if (--t < 0)
{
--
2.35.1



2022-05-11 12:06:50

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] xtensa: no need to initialise statics to 0

On Sat, May 7, 2022 at 7:30 PM Jason Wang <[email protected]> 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 <[email protected]>
> ---
> arch/xtensa/platforms/xt2000/setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my xtensa tree.

-- Max