diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-06-07 09:44:07 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-06-10 11:09:36 +0200 |
commit | 9b29b6b20376ab64e1b043df6301d8a92378e631 (patch) | |
tree | 90ba493df6bc5a7da74b9c9507c9d0fa6d0d652b /drivers/char/random.c | |
parent | crc-itu-t: fix typo in CRC ITU-T polynomial comment (diff) | |
download | linux-9b29b6b20376ab64e1b043df6301d8a92378e631.tar.xz linux-9b29b6b20376ab64e1b043df6301d8a92378e631.zip |
random: avoid checking crng_ready() twice in random_init()
The current flow expands to:
if (crng_ready())
...
else if (...)
if (!crng_ready())
...
The second crng_ready() call is redundant, but can't so easily be
optimized out by the compiler.
This commit simplifies that to:
if (crng_ready()
...
else if (...)
...
Fixes: 560181c27b58 ("random: move initialization functions out of hot pages")
Cc: stable@vger.kernel.org
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/char/random.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index b691b9d59503..4862d4d3ec49 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -801,7 +801,7 @@ int __init random_init(const char *command_line) if (crng_ready()) crng_reseed(); else if (trust_cpu) - credit_init_bits(arch_bytes * 8); + _credit_init_bits(arch_bytes * 8); used_arch_random = arch_bytes * 8 >= POOL_READY_BITS; WARN_ON(register_pm_notifier(&pm_notifier)); |