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 <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2022-07-22 13:13:08 +03:00 committed by Stephanos Ioannidis
parent a429528e3d
commit 4378017ad0

View file

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