drivers: entropy: stm32: don't use zero value

According to the Reference Manual of several series(G0,L5,WL,WB,...)
RNG_DR register value should only be used if it is different from 0:
"Because when it is the case a seed error occurred between RNG_SR
polling and RND_DR output reading (rare event)."

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2021-07-19 17:11:24 +02:00 committed by Christopher Friedt
commit 95b7385bf1

View file

@ -180,6 +180,14 @@ static int random_byte_get(void)
}
retval = LL_RNG_ReadRandData32(rng);
if (retval == 0) {
/* A seed error could have occurred between RNG_SR
* polling and RND_DR output reading.
*/
retval = -EAGAIN;
goto out;
}
retval &= 0xFF;
}