From c95355b4986c48cc816ac1b1bf82d71bea00381e Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 13 Jan 2023 10:39:56 +0000 Subject: [PATCH] trivial: Add a GError parameter to fu_context_get_smbios_string() This matches the behaviour of fu_smbios_get_string() and was probably accidental. --- libfwupdplugin/fu-context.c | 10 ++++++---- libfwupdplugin/fu-context.h | 4 ++-- src/fu-engine.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libfwupdplugin/fu-context.c b/libfwupdplugin/fu-context.c index d6d86e7cf..3d5e34688 100644 --- a/libfwupdplugin/fu-context.c +++ b/libfwupdplugin/fu-context.c @@ -133,6 +133,7 @@ fu_context_get_fdt(FuContext *self, GError **error) * @self: a #FuContext * @structure_type: a SMBIOS structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS * @offset: a SMBIOS offset + * @error: (nullable): optional return location for an error * * Gets a hardware SMBIOS string. * @@ -144,7 +145,7 @@ fu_context_get_fdt(FuContext *self, GError **error) * Since: 1.6.0 **/ const gchar * -fu_context_get_smbios_string(FuContext *self, guint8 structure_type, guint8 offset) +fu_context_get_smbios_string(FuContext *self, guint8 structure_type, guint8 offset, GError **error) { FuContextPrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(FU_IS_CONTEXT(self), NULL); @@ -152,7 +153,7 @@ fu_context_get_smbios_string(FuContext *self, guint8 structure_type, guint8 offs g_critical("cannot use SMBIOS before calling ->load_hwinfo()"); return NULL; } - return fu_smbios_get_string(priv->smbios, structure_type, offset, NULL); + return fu_smbios_get_string(priv->smbios, structure_type, offset, error); } /** @@ -196,6 +197,7 @@ fu_context_get_smbios_data(FuContext *self, guint8 structure_type, GError **erro * @self: a #FuContext * @type: a structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS * @offset: a structure offset + * @error: (nullable): optional return location for an error * * Reads an integer value from the SMBIOS string table of a specific structure. * @@ -207,7 +209,7 @@ fu_context_get_smbios_data(FuContext *self, guint8 structure_type, GError **erro * Since: 1.6.0 **/ guint -fu_context_get_smbios_integer(FuContext *self, guint8 type, guint8 offset) +fu_context_get_smbios_integer(FuContext *self, guint8 type, guint8 offset, GError **error) { FuContextPrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(FU_IS_CONTEXT(self), G_MAXUINT); @@ -215,7 +217,7 @@ fu_context_get_smbios_integer(FuContext *self, guint8 type, guint8 offset) g_critical("cannot use SMBIOS before calling ->load_hwinfo()"); return G_MAXUINT; } - return fu_smbios_get_integer(priv->smbios, type, offset, NULL); + return fu_smbios_get_integer(priv->smbios, type, offset, error); } /** diff --git a/libfwupdplugin/fu-context.h b/libfwupdplugin/fu-context.h index 8a4af4627..7925d925e 100644 --- a/libfwupdplugin/fu-context.h +++ b/libfwupdplugin/fu-context.h @@ -66,9 +66,9 @@ gboolean fu_context_has_flag(FuContext *context, FuContextFlags flag); const gchar * -fu_context_get_smbios_string(FuContext *self, guint8 structure_type, guint8 offset); +fu_context_get_smbios_string(FuContext *self, guint8 structure_type, guint8 offset, GError **error); guint -fu_context_get_smbios_integer(FuContext *self, guint8 type, guint8 offset); +fu_context_get_smbios_integer(FuContext *self, guint8 type, guint8 offset, GError **error); GBytes * fu_context_get_smbios_data(FuContext *self, guint8 structure_type, GError **error); gboolean diff --git a/src/fu-engine.c b/src/fu-engine.c index 2be7fd800..037092a33 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -6602,7 +6602,7 @@ static gchar * fu_engine_attrs_calculate_hsi_for_chassis(FuEngine *self) { guint val = - fu_context_get_smbios_integer(self->ctx, FU_SMBIOS_STRUCTURE_TYPE_CHASSIS, 0x05); + fu_context_get_smbios_integer(self->ctx, FU_SMBIOS_STRUCTURE_TYPE_CHASSIS, 0x05, NULL); /* if emulating, force the chassis type to be valid */ if (self->host_emulation &&