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: 85962d2248 ("hwrng: amd - Convert to new hwrng read() API")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Thorsten Blum 2026-09-23 22:12:58 +02:00 committed by Herbert Xu
parent 10016246d5
commit e7f5ce911e

View File

@ -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);