From: Bart Van Assche <bvanassche@acm.org>
To: Arnd Bergmann <arnd@arndb.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>
Cc: Waiman Long <longman@redhat.com>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Frederic Weisbecker <frederic@kernel.org>,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lockdep: avoid a clang warning
Date: Thu, 07 Mar 2019 08:02:20 -0800 [thread overview]
Message-ID: <1551974540.9796.69.camel@acm.org> (raw)
In-Reply-To: <20190307075222.3424524-1-arnd@arndb.de>
On Thu, 2019-03-07 at 08:52 +0100, Arnd Bergmann wrote:
> 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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> kernel/locking/lockdep.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 21cb81fe6359..35a144dfddf5 100644
> --- 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[];
> +#ifdef CONFIG_PROVE_LOCKING
> +static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
> +#endif
>
> static bool check_lock_chain_key(struct lock_chain *chain)
> {
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
next prev parent reply other threads:[~2019-03-07 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 7:52 [PATCH] lockdep: avoid a clang warning Arnd Bergmann
2019-03-07 16:02 ` Bart Van Assche [this message]
2019-03-09 14:40 ` [tip:locking/urgent] locking/lockdep: Avoid a Clang warning tip-bot for Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1551974540.9796.69.camel@acm.org \
--to=bvanassche@acm.org \
--cc=arnd@arndb.de \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).