locking/lockdep: Hide unused ‘class’ variable [Linux 4.4.187]

This Linux kernel change "locking/lockdep: Hide unused ‘class’ variable" is included in the Linux 4.4.187 release. This change is authored by Arnd Bergmann <arnd [at] arndb.de> on Mon Jul 15 11:27:49 2019 +0200. The commit for this change in Linux stable tree is 32a8925 (patch) which is from upstream commit 68037aa. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 68037aa.

locking/lockdep: Hide unused 'class' variable

[ Upstream commit 68037aa78208f34bda4e5cd76c357f718b838cbb ]

The usage is now hidden in an #ifdef, so we need to move
the variable itself in there as well to avoid this warning:

  kernel/locking/lockdep_proc.c:203:21: error: unused variable 'class' [-Werror,-Wunused-variable]

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Yuyang Du <[email protected]>
Cc: [email protected]
Fixes: 68d41d8c94a3 ("locking/lockdep: Fix lock used or unused stats error")
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 kernel/locking/lockdep_proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 9778b67..35b34ec 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -217,7 +217,6 @@ static void lockdep_stats_debug_show(struct seq_file *m)

 static int lockdep_stats_show(struct seq_file *m, void *v)
-   struct lock_class *class;
    unsigned long nr_unused = 0, nr_uncategorized = 0,
              nr_irq_safe = 0, nr_irq_unsafe = 0,
              nr_softirq_safe = 0, nr_softirq_unsafe = 0,
@@ -228,6 +227,8 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
              sum_forward_deps = 0;

+   struct lock_class *class;
    list_for_each_entry(class, &all_lock_classes, lock_entry) {

        if (class->usage_mask == 0)

Leave a Reply

Your email address will not be published. Required fields are marked *