Skip to contentSkip to conversation

hwrng: amd - report partial reads in non-blocking mode

PATCH In review Thorsten Blum 2 participants 2 messages Sep 23 – Oct 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwrng: amd - report partial reads in non-blocking mode

amd_rng_read() returns 0 if no more data is available, even if some data was already copied to the output buffer. Return the number of copied bytes instead.

Fixes 85962d2248fa ("hwrng: amd - Convert to new hwrng read() API")
---
 drivers/char/hw_random/amd-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/amd-rng.c +1 -1
index 42a18fd41050..9d53f4c3e5bd 100644
@@ -80,7 +80,7 @@ static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
 				if (timeout-- == 0)
 					return read;
 			} else {
-				return 0;
+				return read;
 			}
 		} else {
 			*data = ioread32(priv->iobase + RNGDATA);
maintainer
#1 lore raw
Quoted 10 lines · Thorsten Blum

amd_rng_read() returns 0 if no more data is available, even if some data was already copied to the output buffer. Return the number of copied bytes instead.

Fixes 85962d2248fa ("hwrng: amd - Convert to new hwrng read() API")
---
 drivers/char/hw_random/amd-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt