[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1562596364.8510.1.camel@lca.pw>
Date: Mon, 08 Jul 2019 10:32:44 -0400
From: Qian Cai <cai@....pw>
To: mingo@...hat.com, peterz@...radead.org
Cc: valentin.schneider@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched/core: silence a warning in sched_init()
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@....com>
> Signed-off-by: Qian Cai <cai@....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();
>
Powered by blists - more mailing lists