[PATCH 2/3] hwrng: imx-rngc - read status register for error checks

From: Martin Kaiser
Date: Tue Aug 22 2023 - 11:28:41 EST


The error bit in the status register of the imx-rngc is set for any kind
of error. Details about the error can be read from the bits in the error
status register.

In the imx_rngc_self_test, we just need the info if there was an error or
not. We can check the status register, there's no need to read the error
status register.

Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
---
drivers/char/hw_random/imx-rngc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 85207535fd12..d2df468fd460 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -114,7 +114,7 @@ static int imx_rngc_self_test(struct imx_rngc *rngc)
if (ret < 0)
return ret;

- return readl(rngc->base + RNGC_ERROR) ? -EIO : 0;
+ return (status & RNGC_STATUS_ERROR) ? -EIO : 0;
}

static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait)
--
2.39.2