lkml.org 
[lkml]   [2020]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 03/41] random: prune dead assignment to entropy_bits in credit_entropy_bits()
Date
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@suse.de>
---
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
\
 
 \ /
  Last update: 2020-09-21 10:00    [W:0.464 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site