[PATCH v2 4/6] hwrng: imx-rngc - read status register for error checks

From: Martin Kaiser
Date: Thu Aug 24 2023 - 15:25:11 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 function, 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 09523936d2af..c2582673427d 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