lockdep: avoid a clang warning
PATCH 1/1 lockdep: avoid a clang warning
Clang warns about a tentative array definition without a length:
kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]
There is no real reason to do this here, so just set the same length as in the real definition later in the same file. It has to be hidden in an #ifdef or annotated __maybe_unused though, to avoid the unused-variable warning if CONFIG_PROVE_LOCKING is disabled.
--- kernel/locking/lockdep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/locking/lockdep.c +3 -1
@@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)return true; } -static u16 chain_hlocks[]; +#ifdef CONFIG_PROVE_LOCKING +static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS ]; +#endif static bool check_lock_chain_key (struct lock_chain *chain) {
Signature · 1 line
2.20.0
Quoted 21 lines · Arnd Bergmann
Clang warns about a tentative array definition without a length:
kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]> There is no real reason to do this here, so just set the same length as
in the real definition later in the same file. It has to be hidden in
an #ifdef or annotated__maybe_unusedthough, to avoid the unused-variable
warning ifCONFIG_PROVE_LOCKINGis disabled.Signed-off-by Arnd Bergmann <[email protected]>>---
kernel/locking/lockdep.c|4 +-+-+--1 file changed, 3 insertions(+-), 1 deletion(-)kernel/locking/lockdep.c +1
-1--- a/kernel/locking/lockdep.c +-+-+- b/kernel/locking/lockdep.c@@-842,7 +-842,9 @@static bool
class_lock_list_valid(struct lock_class *c, struct list_head *h)
return true;> }>
-static u16 chain_hlocks[];>+-#ifdefCONFIG_PROVE_LOCKING
+-static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];>+-#endif
Quoted 2 lines
static bool
check_lock_chain_key(struct lock_chain *chain){
tip-bot for Arnd Bergmann
merge bot[tip:locking/urgent] locking/lockdep: Avoid a Clang warning
In reply to Arnd Bergmannlocking/lockdep: Avoid a Clang warning
Commit-ID: 3fe7522fb766f6ee76bf7bc2837f1e3cc52c4e27 Gitweb: https://git.kernel.org/tip/3fe7522fb766f6ee76bf7bc2837f1e3cc52c4e27 Author: Arnd Bergmann <[email protected]> AuthorDate: Thu, 7 Mar 2019 08:52:12 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 9 Mar 2019 14:15:51 +0100
locking/lockdep: Avoid a Clang warning
Clang warns about a tentative array definition without a length:
kernel/locking/lockdep.c:845:12: error: tentative array definition assumed to have one element [-Werror]
There is no real reason to do this here, so just set the same length as in the real definition later in the same file. It has to be hidden in an #ifdef or annotated __maybe_unused though, to avoid the unused-variable warning if CONFIG_PROVE_LOCKING is disabled.
--- kernel/locking/lockdep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/locking/lockdep.c +3 -1
@@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)return true; } -static u16 chain_hlocks[]; +#ifdef CONFIG_PROVE_LOCKING +static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS ]; +#endif static bool check_lock_chain_key (struct lock_chain *chain) {