linux-next: build warning after merge of the random tree
Subsystems (2)
Hi all,
After merging the random tree, today's linux-next build (x86_64 allnoconfig) produced this warning:
drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
820 | static void crng_initialize_secondary(struct crng_state *crng)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Introduced by commit
5cbe0f13b51a ("random: split primary/secondary crng init paths")
Signature · 2 lines
Cheers, Stephen Rothwell
Hi all,
Quoted 11 lines · On Mon, 2 Mar 2020 14:44:52 +1100 Stephen Rothwell <[email protected]> wrote:
After merging the random tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
820 | static voidcrng_initialize_secondary(struct crng_state *crng)| ^~~~~~~~~~~~~~~~~~~~~~~~~Introduced by commit
5cbe0f13b51a("random: split primary/secondary crng init paths")
I am still getting this warning.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 11 lines · Stephen Rothwell
Hi all,
Quoted 8 lines · On Mon, 2 Mar 2020 14:44:52 +1100 Stephen Rothwell <[email protected]> wrote:
After merging the random tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
820 | static voidcrng_initialize_secondary(struct crng_state *crng)| ^~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 5 lines
Quoted 3 lines
Introduced by commit
5cbe0f13b51a("random: split primary/secondary crng init paths")I am still getting this warning.
Sorry, this is my bad.
We only call crng_initialize_secondary() in do_numa_crng_init(), which is only built for CONFIG_NUMA. We can either drop both crng_initialize_secondary() and crng_init_try_arch() under the CONFIG_NUMA ifdef, or add __maybe_unused to crng_initialize_secondary().
Ted, does the below look ok to you? Or would you prefer moving things under the ifdeffery?
Thanks,
Mark.
---->8----
From 6c3a35cd562d53066e11f5f8a6c3a6f63701d3ed Mon Sep 17 00:00:00 2001
From: Mark Rutland <[email protected]>
Date: Tue, 10 Mar 2020 12:09:12 +0000
Subject: [PATCH] random: avoid warnings for !CONFIG_NUMA builds
As crng_initialize_secondary() is only called by do_numa_crng_init(), and the latter is under ifdeffery for CONFIG_NUMA, when CONFIG_NUMA is not selected the compiler will warn that the former is unused:
| drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function] | 820 | static void crng_initialize_secondary(struct crng_state *crng) | | ^~~~~~~~~~~~~~~~~~~~~~~~~
Stephen reports that this happens for x86_64 noallconfig builds.
We could move crng_initialize_secondary() and crng_init_try_arch() under the CONFIG_NUMA ifdeffery, but this has the unfortunate property of separating them from crng_initialize_primary() and crng_init_try_arch_early() respectively. Instead, let's mark crng_initialize_secondary() as __maybe_unused.
--- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/random.c +1 -1
@@ -817,7 +817,7 @@ static bool __init crng_init_try_arch_early(struct crng_state *crng)return arch_init; } -static void crng_initialize_secondary (struct crng_state *crng) +static void __maybe_unused crng_initialize_secondary (struct crng_state *crng) {memcpy (&crng->state[0 ],"expand 32-byte k" ,16 );_get_random_bytes (&crng->state[4 ],sizeof (__u32) *12 );
Signature · 1 line
2.11.0
Theodore Y. Ts'o
maintainerQuoted 20 lines · Mark Rutland
Quoted 11 lines · Stephen Rothwell
Hi all,
Quoted 8 lines · On Mon, 2 Mar 2020 14:44:52 +1100 Stephen Rothwell <[email protected]> wrote:
After merging the random tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
820 | static voidcrng_initialize_secondary(struct crng_state *crng)| ^~~~~~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
Quoted 3 lines
Introduced by commit
5cbe0f13b51a("random: split primary/secondary crng init paths")I am still getting this warning.
Sorry, this is my bad.
Quoted 7 lines
We only call
crng_initialize_secondary()indo_numa_crng_init(), which is only built forCONFIG_NUMA. We can either drop bothcrng_initialize_secondary()andcrng_init_try_arch()under theCONFIG_NUMAifdef, or add__maybe_unusedtocrng_initialize_secondary().Ted, does the below look ok to you? Or would you prefer moving things under the ifdeffery?
Yes, that looks fine. Reordering the functions to move them under the #ifdefs will make the code less readable, and adding extra #ifdef/#endif would also make things less readable.
Thanks for the patch, will apply.
- Ted
Hi all,
Quoted 27 lines · On Tue, 10 Mar 2020 10:46:18 -0400 "Theodore Y. Ts'o" <[email protected]> wrote:
Quoted 25 lines · Mark Rutland
Quoted 11 lines · Stephen Rothwell
Hi all,
Quoted 8 lines · On Mon, 2 Mar 2020 14:44:52 +1100 Stephen Rothwell <[email protected]> wrote:
After merging the random tree, today's linux-next build (
x86_64allnoconfig) produced this warning:
drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function]
820 | static voidcrng_initialize_secondary(struct crng_state *crng)| ^~~~~~~~~~~~~~~~~~~~~~~~~Quoted 5 lines
Quoted 3 lines
Introduced by commit
5cbe0f13b51a("random: split primary/secondary crng init paths")I am still getting this warning.
Sorry, this is my bad.
We only call
crng_initialize_secondary()indo_numa_crng_init(), which is only built forCONFIG_NUMA. We can either drop bothcrng_initialize_secondary()andcrng_init_try_arch()under theCONFIG_NUMAifdef, or add__maybe_unusedtocrng_initialize_secondary().
Quoted 8 lines
Quoted 2 lines
Ted, does the below look ok to you? Or would you prefer moving things under the ifdeffery?
Yes, that looks fine. Reordering the functions to move them under the #ifdefs will make the code less readable, and adding extra #ifdef/#endif would also make things less readable.
Thanks for the patch, will apply.
How are we going with this?
Signature · 2 lines
Cheers, Stephen Rothwell
Theodore Y. Ts'o
maintainerQuoted 7 lines · Stephen Rothwell
Quoted 5 lines
Yes, that looks fine. Reordering the functions to move them under the #ifdefs will make the code less readable, and adding extra #ifdef/#endif would also make things less readable.
Thanks for the patch, will apply.
How are we going with this?
I've applied and pushed out Mark's patch.
- Ted