acpi/ghes: don't crash QEMU if ghes GED is not found
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 15 Jan 2025 12:50:27 +0000 (13:50 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 15 Jan 2025 18:07:11 +0000 (13:07 -0500)
Make error handling within ghes_record_cper_errors() consistent,
i.e. instead abort just print a error in case ghes GED is not found.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <c7e1665ba46df321f0ce161d60dfd681ab827535.1736945236.git.mchehab+huawei@kernel.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/acpi/ghes.c

index 66bd98337ac7c646f527f5d64a802ccc2a6aca25..6843ddf64b29a399e53c8a766fffdf7776637080 100644 (file)
@@ -371,7 +371,10 @@ void ghes_record_cper_errors(const void *cper, size_t len,
 
     acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED,
                                                        NULL));
-    g_assert(acpi_ged_state);
+    if (!acpi_ged_state) {
+        error_setg(errp, "Can't find ACPI_GED object");
+        return;
+    }
     ags = &acpi_ged_state->ghes_state;
 
     start_addr = le64_to_cpu(ags->ghes_addr_le);