Skip to content

Commit 3a85969

Browse files
Tetsuo HandaIngo Molnar
authored andcommitted
lockdep: Add a missing initialization hint to the "INFO: Trying to register non-static key" message
Since this message is printed when dynamically allocated spinlocks (e.g. kzalloc()) are used without initialization (e.g. spin_lock_init()), suggest to developers to check whether initialization functions for objects were called, before making developers wonder what annotation is missing. [ mingo: Minor tweaks to the message. ] Signed-off-by: Tetsuo Handa <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 2dc0572 commit 3a85969

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/locking/lockdep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,8 @@ static bool assign_lock_key(struct lockdep_map *lock)
930930
/* Debug-check: all keys must be persistent! */
931931
debug_locks_off();
932932
pr_err("INFO: trying to register non-static key.\n");
933-
pr_err("the code is fine but needs lockdep annotation.\n");
933+
pr_err("The code is fine but needs lockdep annotation, or maybe\n");
934+
pr_err("you didn't initialize this object before use?\n");
934935
pr_err("turning off the locking correctness validator.\n");
935936
dump_stack();
936937
return false;

0 commit comments

Comments
 (0)