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:
parent
95c3916c60
commit
95b7385bf1
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue