Skip to content

Commit 8148fa2

Browse files
andy-shevfbq
authored andcommitted
lockdep: Mark chain_hlock_class_idx() with __maybe_unused
When chain_hlock_class_idx() 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:435:28: error: unused function 'chain_hlock_class_idx' [-Werror,-Wunused-function] Fix this by marking it with __maybe_unused. 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 <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bd7b5ae commit 8148fa2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/locking/lockdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static inline u16 hlock_id(struct held_lock *hlock)
430430
return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS));
431431
}
432432

433-
static inline unsigned int chain_hlock_class_idx(u16 hlock_id)
433+
static inline __maybe_unused unsigned int chain_hlock_class_idx(u16 hlock_id)
434434
{
435435
return hlock_id & (MAX_LOCKDEP_KEYS - 1);
436436
}

0 commit comments

Comments
 (0)