diff mbox series

ACPI: APEI: ERST: Don't retry read when "Record Store Empty"

Message ID 20240705102517.79689-1-junichi.nomura@nec.com
State New
Headers show
Series ACPI: APEI: ERST: Don't retry read when "Record Store Empty" | expand

Commit Message

NOMURA JUNICHI(野村 淳一) July 5, 2024, 10:25 a.m. UTC
"ERST: [Firmware Warn]: too many record IDs!" is logged on some platforms
when there is no record.  That happens because erst_reader() retries read
when erst_get_record_id_next() returns valid ID and erst_read_record()
fails with -ENOENT.  On those platforms, ACPI_ERST_GET_RECORD_ID returns
ID 0x0 even if record store is empty.  Reading record ID 0x0 on
empty store fails with status code 0x4 (Record Store Empty).  However, both
"Record Store Empty" and "Record Not Found" are translated to -ENOENT,
the reader cannot distinguish between them and tries to read the next id,
which is again 0x0, and repeat that until it fills up the record cache with
invalid entries.

While such firmware might be buggy, we could make the reading loop more
robust by returning different error codes for "Record Not Found" and
"Record Store Empty".

Signed-off-by: Jun'ichi Nomura <junichi.nomura@nec.com>
diff mbox series

Patch

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index bf65e3461531..ce186f8d7a15 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -95,6 +95,7 @@  static inline int erst_errno(int command_status)
 	case ERST_STATUS_NOT_ENOUGH_SPACE:
 		return -ENOSPC;
 	case ERST_STATUS_RECORD_STORE_EMPTY:
+		return -ENODATA;
 	case ERST_STATUS_RECORD_NOT_FOUND:
 		return -ENOENT;
 	default: