]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lockdep: Add a missing initialization hint to the "INFO: Trying to register non-stati...
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sun, 21 Mar 2021 06:49:13 +0000 (15:49 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Apr 2021 11:16:48 +0000 (13:16 +0200)
[ Upstream commit 3a85969e9d912d5dd85362ee37b5f81266e00e77 ]

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210321064913.4619-1-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/locking/lockdep.c

index 8a1758b094b7007a47760a3089396dfeb2ae3667..126c6d524a0f2b6f2d90fdeca27879292dec64d3 100644 (file)
@@ -722,7 +722,8 @@ static bool assign_lock_key(struct lockdep_map *lock)
                /* Debug-check: all keys must be persistent! */
                debug_locks_off();
                pr_err("INFO: trying to register non-static key.\n");
-               pr_err("the code is fine but needs lockdep annotation.\n");
+               pr_err("The code is fine but needs lockdep annotation, or maybe\n");
+               pr_err("you didn't initialize this object before use?\n");
                pr_err("turning off the locking correctness validator.\n");
                dump_stack();
                return false;