From e7f5ce911efb2017381f28bbedb6243a74a9c285 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Wed, 23 Sep 2026 22:12:58 +0200 Subject: [PATCH] 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") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum Signed-off-by: Herbert Xu --- drivers/char/hw_random/amd-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c index dff80daae587..ac2d257793bf 100644 --- a/drivers/char/hw_random/amd-rng.c +++ b/drivers/char/hw_random/amd-rng.c @@ -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);