Skip to content

Commit 3430600

Browse files
andy-shevfbq
authored andcommitted
lockdep: Move lockdep_assert_locked() under #ifdef CONFIG_PROVE_LOCKING
When lockdep_assert_locked() is unused, it prevents kernel builds with clang, `make W=1` and CONFIG_WERROR=y, CONFIG_LOCKDEP=y and CONFIG_PROVE_LOCKING=n: kernel/locking/lockdep.c:160:20: error: unused function 'lockdep_assert_locked' [-Werror,-Wunused-function] Fix this by moving it under the respective ifdeffery. See also commit 6863f56 ("kbuild: allow Clang to find unused static inline functions for W=1 build"). [Boqun: add more config information of the error] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://lore.kernel.org/r/20241202193445.769567-1-andriy.shevchenko@linux.intel.com
1 parent 8148fa2 commit 3430600

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/locking/lockdep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ static inline void lockdep_unlock(void)
157157
__this_cpu_dec(lockdep_recursion);
158158
}
159159

160+
#ifdef CONFIG_PROVE_LOCKING
160161
static inline bool lockdep_assert_locked(void)
161162
{
162163
return DEBUG_LOCKS_WARN_ON(__owner != current);
163164
}
165+
#endif
164166

165167
static struct task_struct *lockdep_selftest_task_struct;
166168

0 commit comments

Comments
 (0)