diff options
author | Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> | 2021-02-01 18:14:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 11:39:41 +0300 |
commit | 41b9ed365456ee8dcc33758fa3bd40dcb73b25df (patch) | |
tree | 1c4a090d139ed386ab44740175738a214ac1e525 | |
parent | 957a92872a7506b51f310b892f4e95cb46a60034 (diff) | |
download | linux-41b9ed365456ee8dcc33758fa3bd40dcb73b25df.tar.xz |
hwrng: timeriomem - Fix cooldown period calculation
[ Upstream commit e145f5565dc48ccaf4cb50b7cfc48777bed8c100 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/char/hw_random/timeriomem-rng.c | 2 |
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 f615684028af..ba01f24db6db 100644 --- a/drivers/char/hw_random/timeriomem-rng.c +++ b/drivers/char/hw_random/timeriomem-rng.c @@ -72,7 +72,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); |