From: Punit Agrawal <punit1.agrawal@xxxxxxxxxxxxx> The timespec structure "stop" is initialised whether it is used or not as the compiler is not smart enough to figure out that it's use is always guarded by the "duration" variable. As a result, "stop" needs to be initialised whether it's used or not to avoid a compiler warning. Replace the duplicate memset statements by initializing "stop" using structure initialiser. Signed-off-by: Punit Agrawal <punit1.agrawal@xxxxxxxxxxxxx> --- src/cyclictest/cyclictest.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 0c1e6617e0e1..d06ed01c58f4 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -507,7 +507,7 @@ static void *timerthread(void *param) struct sigevent sigev; sigset_t sigset; timer_t timer; - struct timespec now, next, interval, stop; + struct timespec now, next, interval, stop = { 0 }; struct itimerval itimer; struct itimerspec tspec; struct thread_stat *stat = par->stats; @@ -516,8 +516,6 @@ static void *timerthread(void *param) pthread_t thread; unsigned long smi_now, smi_old = 0; - memset(&stop, 0, sizeof(stop)); - /* if we're running in numa mode, set our memory node */ if (par->node != -1) rt_numa_set_numa_run_on_node(par->node, par->cpu); @@ -598,7 +596,6 @@ static void *timerthread(void *param) tsnorm(&next); if (duration) { - memset(&stop, 0, sizeof(stop)); /* grrr */ stop = now; stop.tv_sec += duration; } -- 2.32.0