From 4378017ad0d0f2306ac087e021b890bba69a0f90 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 22 Jul 2022 13:13:08 +0300 Subject: [PATCH] edac: ibecc: Correct indication of -ENODATA According to IBECC spec ECC Error log register is only valid when ECC_ERROR_CERRSTS or ECC_ERROR_MERRSTS bits are set. Signed-off-by: Andrei Emeltchenko --- drivers/edac/edac_ibecc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/edac/edac_ibecc.c b/drivers/edac/edac_ibecc.c index df8b6386866..06033a2bbb4 100644 --- a/drivers/edac/edac_ibecc.c +++ b/drivers/edac/edac_ibecc.c @@ -194,7 +194,11 @@ static int inject_error_trigger(const struct device *dev) static int ecc_error_log_get(const struct device *dev, uint64_t *value) { *value = ibecc_read_reg64(dev, IBECC_ECC_ERROR_LOG); - if (*value == 0) { + /** + * The ECC Error log register is only valid when ECC_ERROR_CERRSTS + * or ECC_ERROR_MERRSTS error status bits are set + */ + if ((*value & (ECC_ERROR_MERRSTS | ECC_ERROR_CERRSTS)) == 0) { return -ENODATA; }