Skip to content

Commit

Permalink
hwrng: stm32 - don't read if data is not available
Browse files Browse the repository at this point in the history
If buffer is being filled up, stop reading instead of reading 0.

Change-Id: Idbb44823dbf701793f5af88ca7c2b4fa2a050230
Signed-off-by: Sebastien PASDELOUP <[email protected]>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/326899
ACI: CITOOLS <[email protected]>
Reviewed-by: Gatien CHEVALLIER <[email protected]>
Domain-Review: Gatien CHEVALLIER <[email protected]>
  • Loading branch information
spasdeloup authored and ashishverma2691 committed Sep 13, 2023
1 parent 3dcc20d commit 94c9fea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/char/hw_random/stm32-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
"bad RNG status - %x\n", sr))
writel_relaxed(0, priv->base + RNG_SR);
break;
} else if (!sr) {
/* The FIFO is being filled up */
break;
}

*(u32 *)data = readl_relaxed(priv->base + RNG_DR);
Expand Down

0 comments on commit 94c9fea

Please sign in to comment.