From: Qian Cai <cai@lca.pw>
To: mingo@redhat.com, peterz@infradead.org
Cc: valentin.schneider@arm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/core: silence a warning in sched_init()
Date: Mon, 08 Jul 2019 10:32:44 -0400 [thread overview]
Message-ID: <1562596364.8510.1.camel@lca.pw> (raw)
In-Reply-To: <1561466662-22314-1-git-send-email-cai@lca.pw>
Ping. Per discussion, sounds like this is the best thing to do in order to avoid
compilation warnings.
On Tue, 2019-06-25 at 08:44 -0400, Qian Cai wrote:
> Compiling a kernel with both FAIR_GROUP_SCHED=n and RT_GROUP_SCHED=n
> will generate a warning using W=1,
>
> kernel/sched/core.c: In function 'sched_init':
> kernel/sched/core.c:5906:32: warning: variable 'ptr' set but not used
> [-Wunused-but-set-variable]
> unsigned long alloc_size = 0, ptr;
> ^~~
>
> It apparently the maintainers don't like the previous fix [1] which
> contains ugly idefs, so silence it by appending the __maybe_unused
> attribute for it instead.
>
> [1] https://lore.kernel.org/lkml/1559681162-5385-1-git-send-email-cai@lca.pw/
>
> Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>
> v2: Incorporate the feedback from Valentin.
>
> kernel/sched/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 874c427742a9..12b9b69c8a66 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5903,7 +5903,8 @@ int in_sched_functions(unsigned long addr)
> void __init sched_init(void)
> {
> int i, j;
> - unsigned long alloc_size = 0, ptr;
> + unsigned long alloc_size = 0;
> + unsigned long __maybe_unused ptr;
>
> wait_bit_init();
>
prev parent reply other threads:[~2019-07-08 14:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 12:44 [PATCH v2] sched/core: silence a warning in sched_init() Qian Cai
2019-06-25 13:52 ` Peter Zijlstra
2019-06-25 14:04 ` Qian Cai
2019-06-25 14:25 ` Peter Zijlstra
2019-06-25 15:07 ` Qian Cai
2019-06-25 15:57 ` Peter Zijlstra
2019-07-18 20:44 ` Qian Cai
2019-07-08 14:32 ` Qian Cai [this message]
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=1562596364.8510.1.camel@lca.pw \
--to=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=valentin.schneider@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).