Skip to content

Commit a1dc044

Browse files
Qian Caiingomolnar
authored andcommitted
sched/core: Silence a warning in sched_init()
Compiling a kernel with both FAIR_GROUP_SCHED=n and RT_GROUP_SCHED=n will generate a compiler warning: kernel/sched/core.c: In function 'sched_init': kernel/sched/core.c:5906:32: warning: variable 'ptr' set but not used It is unnecessary to have both "alloc_size" and "ptr", so just combine them. Signed-off-by: Qian Cai <cai@lca.pw> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: valentin.schneider@arm.com Link: https://lkml.kernel.org/r/20190720012319.884-1-cai@lca.pw Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent a07db5c commit a1dc044

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎kernel/sched/core.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6430,19 +6430,19 @@ DECLARE_PER_CPU(cpumask_var_t, select_idle_mask);
64306430

64316431
void __init sched_init(void)
64326432
{
6433-
unsigned long alloc_size = 0, ptr;
6433+
unsigned long ptr = 0;
64346434
int i;
64356435

64366436
wait_bit_init();
64376437

64386438
#ifdef CONFIG_FAIR_GROUP_SCHED
6439-
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
6439+
ptr += 2 * nr_cpu_ids * sizeof(void **);
64406440
#endif
64416441
#ifdef CONFIG_RT_GROUP_SCHED
6442-
alloc_size += 2 * nr_cpu_ids * sizeof(void **);
6442+
ptr += 2 * nr_cpu_ids * sizeof(void **);
64436443
#endif
6444-
if (alloc_size) {
6445-
ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT);
6444+
if (ptr) {
6445+
ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
64466446

64476447
#ifdef CONFIG_FAIR_GROUP_SCHED
64486448
root_task_group.se = (struct sched_entity **)ptr;

0 commit comments

Comments
 (0)