hwrng: stm32 - fix read of the last word
authorTomas Marek <tomas.marek@elrest.cz>
Wed, 12 Oct 2022 16:09:24 +0000 (18:09 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Oct 2022 11:15:35 +0000 (19:15 +0800)
commite64f57e8cd5abe167cdf453869d6274608480519
treec7f030a773f9bc7d43534548dfcd9a040563f261
parent7e11a4fc84dcc9746936c46d9a88489a365fea45
hwrng: stm32 - fix read of the last word

The stm32_rng_read() function samples TRNG by 4 bytes until at
least 5 bytes are free in the input buffer. The last four bytes
are never read. For example, 60 bytes are returned in case the
input buffer size is 64 bytes.

Read until at least 4 bytes are free in the input buffer. Fill
the buffer entirely in case the buffer size is divisible by 4.

Cc: Oleg Karfich <oleg.karfich@wago.com>
Signed-off-by: Tomas Marek <tomas.marek@elrest.cz>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/stm32-rng.c