* [PATCH 1/1] ACPI/APEI: Fix the returned value in erst_dbg_read
@ 2012-12-14 8:08 Adrian Huang
2012-12-14 23:41 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Huang @ 2012-12-14 8:08 UTC (permalink / raw)
To: Len Brown, Rafael J. Wysocki, linux-acpi, linux-kernel; +Cc: Adrian Huang
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>
---
drivers/acpi/apei/erst-dbg.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c
index 903549d..04ab5c9 100644
--- a/drivers/acpi/apei/erst-dbg.c
+++ b/drivers/acpi/apei/erst-dbg.c
@@ -111,8 +111,17 @@ retry_next:
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 */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] ACPI/APEI: Fix the returned value in erst_dbg_read
2012-12-14 8:08 [PATCH 1/1] ACPI/APEI: Fix the returned value in erst_dbg_read Adrian Huang
@ 2012-12-14 23:41 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2012-12-14 23:41 UTC (permalink / raw)
To: Adrian Huang; +Cc: Len Brown, linux-acpi, linux-kernel
On Friday, December 14, 2012 04:08:34 PM Adrian Huang wrote:
> 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.
I'm queuing this up for submission as v3.8 material.
Thanks,
Rafael
> Signed-off-by: Adrian Huang <adrian.huang@hp.com>
> ---
> drivers/acpi/apei/erst-dbg.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c
> index 903549d..04ab5c9 100644
> --- a/drivers/acpi/apei/erst-dbg.c
> +++ b/drivers/acpi/apei/erst-dbg.c
> @@ -111,8 +111,17 @@ retry_next:
> 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 */
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-14 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14 8:08 [PATCH 1/1] ACPI/APEI: Fix the returned value in erst_dbg_read Adrian Huang
2012-12-14 23:41 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).