Skip to contentSkip to conversation

kernel/cgroup/cgroup.c:3360: warning: unused variable 'cgrp'

PATCH New kbuild test robot 2 participants 2 messages Oct 26, 2017 – Oct 30, 2017 1 message not in the archive cgroup

lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-4.15
head:   d41bf8c9deaed1a90b18d3ffc5639d4c19f0259a
commit: d41bf8c9deaed1a90b18d3ffc5639d4c19f0259a [8/8] cgroup, sched: Move basic cpu stats from cgroup.stat to cpu.stat
config: x86_64-randconfig-a0-10270506 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        git checkout d41bf8c9deaed1a90b18d3ffc5639d4c19f0259a
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

kernel/cgroup/cgroup.c: In function 'cpu_stat_show':

>> kernel/cgroup/cgroup.c:3360: warning: unused variable 'cgrp'

vim +/cgrp +3360 kernel/cgroup/cgroup.c

3357
3358 static int cpu_stat_show(struct seq_file *seq, void *v)
3359 {

> 3360		struct cgroup *cgrp = seq_css(seq)->cgroup;

3361 int ret = 0;
3362
3363 cgroup_stat_show_cputime(seq);
3364 #ifdef CONFIG_CGROUP_SCHED
3365 ret = cgroup_extra_stat_show(seq, cgrp, cpu_cgrp_id);
3366 #endif
3367 return ret;
3368 }
3369

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

A message that is not in the archive (sent off-list or not yet received): 201710270642.JXcfWPVR%[email protected]

#2 lore raw

PATCH 1/1 cgroup: mark @cgrp __maybe_unused in cpu_stat_show()

From c3ba13298709f46e72b22d087d0aa02bd012e4b0 Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Mon, 30 Oct 2017 08:13:14 -0700

The local variable @cgrp isn't used if !CONFIG_CGROUP_SCHED. Mark the variable with __maybe_unused to avoid a compile warning.

---
Applied to cgroup/for-4.15.

Thanks.

 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cgroup.c +1 -1
index d9773e4..d6ed725 100644
@@ -3357,7 +3357,7 @@ static int __maybe_unused cgroup_extra_stat_show(struct seq_file *seq,
 
 static int cpu_stat_show(struct seq_file *seq, void *v)
 {
-	struct cgroup *cgrp = seq_css(seq)->cgroup;
+	struct cgroup __maybe_unused *cgrp = seq_css(seq)->cgroup;
 	int ret = 0;
 
 	cgroup_stat_show_cputime(seq);
Signature · 1 line
2.9.5