Skip to contentSkip to conversation

ACPI / tables: Return error from table parse handler

PATCH In review Matthias Brugger 2 participants 3 messages May 19, 2016 – May 20, 2016 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / tables: Return error from table parse handler

The handler called in acpi_table_parse may return an error. This patch returns this error instead of ignoring it.

---
 drivers/acpi/tables.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/tables.c +3 -2
index a372f9e..fb5cd80 100644
@@ -394,6 +394,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
 {
 	struct acpi_table_header *table = NULL;
 	acpi_size tbl_size;
+	int ret;
 
 	if (acpi_disabled)
 		return -ENODEV;
@@ -407,9 +408,9 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
 		acpi_get_table_with_size(id, 0, &table, &tbl_size);
 
 	if (table) {
-		handler(table);
+		ret = handler(table);
 		early_acpi_os_unmap_memory(table, tbl_size);
-		return 0;
+		return ret;
 	} else
 		return -ENODEV;
 }
Signature · 1 line
2.6.6
#1 lore raw
Quoted 2 lines · Matthias Brugger

The handler called in acpi_table_parse may return an error. This patch returns this error instead of ignoring it.

And does it address any particular practical problem or is it just a code cleanup?

Quoted 30 lines
---
 drivers/acpi/tables.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/tables.c +3 -3
index a372f9e..fb5cd80 100644
@@ -394,6 +394,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
 {
        struct acpi_table_header *table = NULL;
        acpi_size tbl_size;
+       int ret;
 
        if (acpi_disabled)
                return -ENODEV;
@@ -407,9 +408,9 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
                acpi_get_table_with_size(id, 0, &table, &tbl_size);
 
        if (table) {
-               handler(table);
+               ret = handler(table);
                early_acpi_os_unmap_memory(table, tbl_size);
-               return 0;
+               return ret;
        } else
                return -ENODEV;
 }
--
#2 lore raw
Quoted 7 lines · Rafael J. Wysocki
Quoted 2 lines · Matthias Brugger

The handler called in acpi_table_parse may return an error. This patch returns this error instead of ignoring it.

And does it address any particular practical problem or is it just a code cleanup?

It's just a code cleanup.

Quoted 31 lines
Quoted 30 lines
---
  drivers/acpi/tables.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/tables.c +3 -3
index a372f9e..fb5cd80 100644
@@ -394,6 +394,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
  {
         struct acpi_table_header *table = NULL;
         acpi_size tbl_size;
+       int ret;
 
         if (acpi_disabled)
                 return -ENODEV;
@@ -407,9 +408,9 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
                 acpi_get_table_with_size(id, 0, &table, &tbl_size);
 
         if (table) {
-               handler(table);
+               ret = handler(table);
                 early_acpi_os_unmap_memory(table, tbl_size);
-               return 0;
+               return ret;
         } else
                 return -ENODEV;
  }
--