Skip to content

Commit

Permalink
ACPI / APEI: Fix the returned value in erst_dbg_read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Huang authored and Rafael J. Wysocki committed Jan 3, 2013
1 parent d1c3ed6 commit 6780aa6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/acpi/apei/erst-dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf,
if (rc)
goto out;
/* no more record */
if (id == APEI_ERST_INVALID_RECORD_ID)
if (id == APEI_ERST_INVALID_RECORD_ID) {
/*
* If the persistent store is empty initially, the function
* 'erst_read' below will return "-ENOENT" value. This causes
* 'retry_next' label is entered again. The returned value
* should be zero indicating the read operation is EOF.
*/
len = 0;

goto out;
}
retry:
rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
/* The record may be cleared by others, try read next record */
Expand Down

0 comments on commit 6780aa6

Please sign in to comment.