Skip to content

Commit 94c9fea

Browse files
spasdeloupashishverma2691
authored andcommitted
hwrng: stm32 - don't read if data is not available
If buffer is being filled up, stop reading instead of reading 0. Change-Id: Idbb44823dbf701793f5af88ca7c2b4fa2a050230 Signed-off-by: Sebastien PASDELOUP <sebastien.pasdeloup-ext@st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/326899 ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Gatien CHEVALLIER <gatien.chevallier@st.com> Domain-Review: Gatien CHEVALLIER <gatien.chevallier@st.com>
1 parent 3dcc20d commit 94c9fea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/char/hw_random/stm32-rng.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
6464
"bad RNG status - %x\n", sr))
6565
writel_relaxed(0, priv->base + RNG_SR);
6666
break;
67+
} else if (!sr) {
68+
/* The FIFO is being filled up */
69+
break;
6770
}
6871

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

0 commit comments

Comments
 (0)