summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJan Henrik Weinstock <jan.weinstock@rwth-aachen.de>2021-02-01 16:14:59 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2021-02-10 07:55:55 +0100
commite145f5565dc48ccaf4cb50b7cfc48777bed8c100 (patch)
tree0e71daa23e4780b7c2a0f10797889506b788e05f /drivers/char
parentcrypto: marvell - CRYPTO_DEV_OCTEONTX2_CPT should depend on ARCH_THUNDER2 (diff)
downloadlinux-e145f5565dc48ccaf4cb50b7cfc48777bed8c100.tar.xz
linux-e145f5565dc48ccaf4cb50b7cfc48777bed8c100.zip
hwrng: timeriomem - Fix cooldown period calculation
Ensure cooldown period tolerance of 1% is actually accounted for. Fixes: ca3bff70ab32 ("hwrng: timeriomem - Improve performance...") Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/timeriomem-rng.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index e262445fed5f..f35f0f31f52a 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -69,7 +69,7 @@ static int timeriomem_rng_read(struct hwrng *hwrng, void *data,
*/
if (retval > 0)
usleep_range(period_us,
- period_us + min(1, period_us / 100));
+ period_us + max(1, period_us / 100));
*(u32 *)data = readl(priv->io_base);
retval += sizeof(u32);