[PATCH 13/27] locking/lockdep: Complain if a lock object has no name

From: Bart Van Assche
Date: Wed Nov 28 2018 - 18:44:15 EST


Lockdep reports about lock objects that do not have a name are hard to
interpret. Hence complain if no name has been assigned to a lock object.

Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
kernel/locking/lockdep.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 8177a8de1e1d..41fd3b279220 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -743,6 +743,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
struct hlist_head *hash_head;
struct lock_class *class;

+ WARN_ON_ONCE(!lock->name);
DEBUG_LOCKS_WARN_ON(!irqs_disabled());

class = look_up_lock_class(lock, subclass);
--
2.20.0.rc0.387.gc7a69e6b6c-goog