[RFC PATCH 03/41] random: prune dead assignment to entropy_bits in credit_entropy_bits()

From: Nicolai Stange
Date: Mon Sep 21 2020 - 04:02:00 EST


Since commit 90ea1c6436d2 ("random: remove the blocking pool"), the
last assignment to 'entropy_bits' is dead. Remove it.

While at it, move the declaration of 'entropy_bits' one scope down and make
it const: it's not used anywhere outside and never updated after
initialization.

Signed-off-by: Nicolai Stange <nstange@xxxxxxx>
---
drivers/char/random.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index c4b7bdbd460e..14c39608cc17 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -716,13 +716,12 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
entropy_count >> ENTROPY_SHIFT, _RET_IP_);

if (r == &input_pool) {
- int entropy_bits = entropy_count >> ENTROPY_SHIFT;
-
if (crng_init < 2) {
+ const int entropy_bits = entropy_count >> ENTROPY_SHIFT;
+
if (entropy_bits < 128)
return;
crng_reseed(&primary_crng, r);
- entropy_bits = ENTROPY_BITS(r);
}
}
}
--
2.26.2