random: simplify arithmetic function flow in account()
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 17 Jan 2022 17:43:02 +0000 (18:43 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 17 Jan 2022 17:55:08 +0000 (18:55 +0100)
commit99e057c016b6b6d3adbbc76552d2f8a8ec885aca
tree8894b1cc8f18ba912ed98170c1ba8094712f4885
parentb48e412a0b738f8fb970d64ce596eaa4415c6af7
random: simplify arithmetic function flow in account()

Now that have_bytes is never modified, we can simplify this function.
First, we move the check for negative entropy_count to be first. That
ensures that subsequent reads of this will be non-negative. Then,
have_bytes and ibytes can be folded into their one use site in the
min_t() function.

Suggested-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c