On 2014-3-19 11:51, Ashwin Chaugule wrote:
Add error checks to various methods and bail early if requisite tables are not found.
Signed-off-by: Ashwin Chaugule ashwin.chaugule@linaro.org
drivers/acpi/plat/arm-core.c | 61 ++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 19 deletions(-)
diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index 9704229..87e93b2 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -222,27 +222,40 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table) return 0; } -static void __init acpi_process_madt(void) +static int __init acpi_process_madt(void) {
- int error;
- if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
/*
* Parse MADT GIC cpu interface entries
*/
error = acpi_parse_madt_gic_entries();
if (!error) {
/*
* Parse MADT GIC distributor entries
*/
acpi_parse_madt_gic_distributor_entries();
}
- int err = 0;
- err = acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt);
- if (err) {
pr_err("Failed to parse MADT\n");
goto out_err;
- }
- /*
* Parse MADT GIC cpu interface entries
*/
- err = acpi_parse_madt_gic_entries();
- if (err) {
pr_err("Failed to parse GIC entries from MADT\n");
goto out_err;
- }
- /*
* Parse MADT GIC distributor entries
*/
- err = acpi_parse_madt_gic_distributor_entries();
- if (err) {
pr_err("Failed to find GIC Distributor entries from MADT\n");
}goto out_err;
pr_info("Using ACPI for processor (GIC) configuration information\n");
- return 0;
- return;
+out_err:
- pr_err("Err processing GIC information\n");
- return err;
} /* @@ -273,20 +286,30 @@ void __init acpi_boot_table_init(void) int __init acpi_boot_init(void) {
- int err = 0; /*
*/ if (acpi_disabled) return -ENODEV;
- If acpi_disabled, bail out
- acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
- err = acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
- if (err) {
pr_err("Failed to find FADT\n");
goto out_err;
I think we can't jump out and ignore the MADT table parsing here, the system may still run ok if we meet some error when we parsing FADT (for example we may get wrong information from the FADT because of BIOS bug), we can go on and get MADT parsed for SMP.
Others look good to me.
Thanks Hanjun
- }
/* * Process the Multiple APIC Description Table (MADT), if present */
- acpi_process_madt();
- err = acpi_process_madt();
- if (err) {
pr_err("Failed to process MADT\n");
goto out_err;
- }
- return 0;
+out_err:
- return err;
} static int __init parse_acpi(char *arg)