Skip to contentSkip to conversation

lockdep: fix an unused variable warning

PATCH New [email protected] 1 participant 2 messages Jul 24, 2019 Locking primitives

lore
Share & tools
lore
#0 lore raw

cover lockdep: fix an unused variable warning

From: John Hubbard <[email protected]>

Hi,

I just ran into this while building other things against today's linux.git.

For the !CONFIG_PROVE_LOCKING case, the "class" variable is left unused. Rather than tease apart the functionality in lockdep_stats_show(), where class is used to increment up to 15 local variables, this patch merely adds yet another ifdef to fix the build warning.

I'll leave it to a larger cleanup effort (which is probably not worth the churn, actually) to avoid all of the ifdef slicing up of these routines.

John Hubbard (1):
lockdep: fix an unused variable warning

 kernel/locking/lockdep_proc.c | 2 ++
 1 file changed, 2 insertions(+)
Signature · 1 line
2.22.0
#1 lore raw

PATCH 1/1 lockdep: fix an unused variable warning

From: John Hubbard <[email protected]>

For the !CONFIG_PROVE_LOCKING case, the "class" variable is left unused. Rather than tease apart the functionality in lockdep_stats_show(), where class is used to increment up to 15 local variables, this patch merely adds yet another ifdef to fix the build warning.

---
 kernel/locking/lockdep_proc.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/locking/lockdep_proc.c +2 -0
index 65b6a1600c8f..86f0868a1bfc 100644
@@ -200,7 +200,9 @@ static void lockdep_stats_debug_show(struct seq_file *m)
 
 static int lockdep_stats_show(struct seq_file *m, void *v)
 {
+#ifdef CONFIG_PROVE_LOCKING
 	struct lock_class *class;
+#endif
 	unsigned long nr_unused = 0, nr_uncategorized = 0,
 		      nr_irq_safe = 0, nr_irq_unsafe = 0,
 		      nr_softirq_safe = 0, nr_softirq_unsafe = 0,
Signature · 1 line
2.22.0