random: remove unnecessary unlikely()
authorYangtao Li <tiny.windzz@gmail.com>
Tue, 7 Jan 2020 21:10:28 +0000 (16:10 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 7 Jan 2020 21:10:28 +0000 (16:10 -0500)
WARN_ON() already contains an unlikely(), so it's not necessary to use
unlikely.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Link: https://lore.kernel.org/r/20190607182517.28266-1-tiny.windzz@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
drivers/char/random.c

index b68da8eefcdbe9f1d77e2530665a60199bb806c8..e3309ce12f1db07ca5eb20b5e6540079336f4e16 100644 (file)
@@ -736,10 +736,9 @@ retry:
                } while (unlikely(entropy_count < pool_size-2 && pnfrac));
        }
 
-       if (unlikely(entropy_count < 0)) {
+       if (WARN_ON(entropy_count < 0)) {
                pr_warn("random: negative entropy/overflow: pool %s count %d\n",
                        r->name, entropy_count);
-               WARN_ON(1);
                entropy_count = 0;
        } else if (entropy_count > pool_size)
                entropy_count = pool_size;
@@ -1364,10 +1363,9 @@ retry:
        if (ibytes < min)
                ibytes = 0;
 
-       if (unlikely(entropy_count < 0)) {
+       if (WARN_ON(entropy_count < 0)) {
                pr_warn("random: negative entropy count: pool %s count %d\n",
                        r->name, entropy_count);
-               WARN_ON(1);
                entropy_count = 0;
        }
        nfrac = ibytes << (ENTROPY_SHIFT + 3);