void __init acpi_hest_init(void) { acpi_status status; int rc = -ENODEV; unsigned int ghes_count = 0; if (hest_disable) { pr_info(HEST_PFX "Table parsing disabled.\n"); return; } status = acpi_get_table(ACPI_SIG_HEST, 0, (struct acpi_table_header **)&hest_tab); if (status == AE_NOT_FOUND) { hest_disable = HEST_NOT_FOUND; return; } else if (ACPI_FAILURE(status)) { const char *msg = acpi_format_exception(status); pr_err(HEST_PFX "Failed to get table, %s\n", msg); rc = -EINVAL; goto err; } rc = apei_hest_parse(hest_parse_cmc, NULL); if (rc) goto err; if (!ghes_disable) { rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count); if (rc) goto err; rc = hest_ghes_dev_register(ghes_count); if (rc) goto err; } pr_info(HEST_PFX "Table parsing has been initialized.\n"); return; err: hest_disable = HEST_DISABLED; }
static int __init hest_init(void) { acpi_status status; int rc = -ENODEV; unsigned int ghes_count = 0; if (acpi_disabled) goto err; if (hest_disable) { pr_info(HEST_PFX "HEST tabling parsing is disabled.\n"); goto err; } status = acpi_get_table(ACPI_SIG_HEST, 0, (struct acpi_table_header **)&hest_tab); if (status == AE_NOT_FOUND) { pr_info(HEST_PFX "Table is not found!\n"); goto err; } else if (ACPI_FAILURE(status)) { const char *msg = acpi_format_exception(status); pr_err(HEST_PFX "Failed to get table, %s\n", msg); rc = -EINVAL; goto err; } rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count); if (rc) goto err; rc = hest_ghes_dev_register(ghes_count); if (rc) goto err; pr_info(HEST_PFX "HEST table parsing is initialized.\n"); return 0; err: hest_disable = 1; return rc; }