Skip to content

Commit e0d648f

Browse files
suryasaimadhuIngo Molnar
authored andcommitted
sched/vtime: Work around an unitialized variable warning
Work around this warning: kernel/sched/cputime.c: In function ‘kcpustat_field’: kernel/sched/cputime.c:1007:6: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] because GCC can't see that val is used only when err is 0. Acked-by: Peter Zijlstra <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3662daf commit e0d648f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/sched/cputime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,12 @@ u64 kcpustat_field(struct kernel_cpustat *kcpustat,
10031003
enum cpu_usage_stat usage, int cpu)
10041004
{
10051005
u64 *cpustat = kcpustat->cpustat;
1006+
u64 val = cpustat[usage];
10061007
struct rq *rq;
1007-
u64 val;
10081008
int err;
10091009

10101010
if (!vtime_accounting_enabled_cpu(cpu))
1011-
return cpustat[usage];
1011+
return val;
10121012

10131013
rq = cpu_rq(cpu);
10141014

0 commit comments

Comments
 (0)