Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI / APEI: Fix the returned value in erst_dbg_read

If the persistent store is empty initially, the function 'erst_dbg_read'
returns a nonzero value. The better way is to return a zero indicating the
read operation reaches EOF.

Tested on two different servers.

Signed-off-by: Adrian Huang <adrian.huang@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Adrian Huang and committed by
Rafael J. Wysocki
6780aa68 d1c3ed66

+10 -1
+10 -1
drivers/acpi/apei/erst-dbg.c
··· 111 111 if (rc) 112 112 goto out; 113 113 /* no more record */ 114 - if (id == APEI_ERST_INVALID_RECORD_ID) 114 + if (id == APEI_ERST_INVALID_RECORD_ID) { 115 + /* 116 + * If the persistent store is empty initially, the function 117 + * 'erst_read' below will return "-ENOENT" value. This causes 118 + * 'retry_next' label is entered again. The returned value 119 + * should be zero indicating the read operation is EOF. 120 + */ 121 + len = 0; 122 + 115 123 goto out; 124 + } 116 125 retry: 117 126 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); 118 127 /* The record may be cleared by others, try read next record */