Skip to content

Commit ab9a7e2

Browse files
mrutland-armtytso
authored andcommitted
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. Link: https://lore.kernel.org/r/[email protected] Fixes: 5cbe0f1 ("random: split primary/secondary crng init paths") Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Mark Rutland <[email protected]> Cc: Theodore Ts'o <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent e00d996 commit ab9a7e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/char/random.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static bool __init crng_init_try_arch_early(struct crng_state *crng)
817817
return arch_init;
818818
}
819819

820-
static void crng_initialize_secondary(struct crng_state *crng)
820+
static void __maybe_unused crng_initialize_secondary(struct crng_state *crng)
821821
{
822822
memcpy(&crng->state[0], "expand 32-byte k", 16);
823823
_get_random_bytes(&crng->state[4], sizeof(__u32) * 12);

0 commit comments

Comments
 (0)