summary refs log tree commit diff stats
path: root/include/hw/firmware/smbios.h
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2024-03-14 16:22:53 +0100
committerMichael S. Tsirkin <mst@redhat.com>2024-03-18 08:42:45 -0400
commit643e1c9ef9d90a6e80b82998d41c91302fef506b (patch)
treede2b3799fea8c84decebeca94ef6968a3c187a8a /include/hw/firmware/smbios.h
parentb42b0e4daaa543bc9f8e24662f94d65f6481c4a0 (diff)
downloadfocaccia-qemu-643e1c9ef9d90a6e80b82998d41c91302fef506b.tar.gz
focaccia-qemu-643e1c9ef9d90a6e80b82998d41c91302fef506b.zip
smbios: handle errors consistently
Current code uses mix of error_report()+exit(1)
and error_setg() to handle errors.
Use newer error_setg() everywhere, beside consistency
it will allow to detect error condition without killing
QEMU and attempt switch-over to SMBIOS3.x tables/entrypoint
in follow up patch.

while at it, clear smbios_tables pointer after freeing.
that will avoid double free if smbios_get_tables() is called
multiple times.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Message-Id: <20240314152302.2324164-13-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/firmware/smbios.h')
-rw-r--r--include/hw/firmware/smbios.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index ccc51e72f5..d4b91d5a14 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -326,7 +326,7 @@ struct smbios_type_127 {
     struct smbios_structure_header header;
 } QEMU_PACKED;
 
-void smbios_validate_table(void);
+bool smbios_validate_table(Error **errp);
 void smbios_add_usr_blob_size(size_t size);
 void smbios_entry_add(QemuOpts *opts, Error **errp);
 void smbios_set_cpuid(uint32_t version, uint32_t features);
@@ -334,7 +334,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
                          const char *version,
                          bool uuid_encoded, SmbiosEntryPointType ep_type);
 void smbios_set_default_processor_family(uint16_t processor_family);
-uint8_t *smbios_get_table_legacy(size_t *length);
+uint8_t *smbios_get_table_legacy(size_t *length, Error **errp);
 void smbios_get_tables(MachineState *ms,
                        const struct smbios_phys_mem_area *mem_array,
                        const unsigned int mem_array_size,