trivial: Add a GError parameter to fu_context_get_smbios_string()

This matches the behaviour of fu_smbios_get_string() and was probably accidental.
This commit is contained in:
Richard Hughes 2023-01-13 10:39:56 +00:00
parent 17156f13d5
commit c95355b498
3 changed files with 9 additions and 7 deletions

View File

@ -133,6 +133,7 @@ fu_context_get_fdt(FuContext *self, GError **error)
* @self: a #FuContext * @self: a #FuContext
* @structure_type: a SMBIOS structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS * @structure_type: a SMBIOS structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS
* @offset: a SMBIOS offset * @offset: a SMBIOS offset
* @error: (nullable): optional return location for an error
* *
* Gets a hardware SMBIOS string. * Gets a hardware SMBIOS string.
* *
@ -144,7 +145,7 @@ fu_context_get_fdt(FuContext *self, GError **error)
* Since: 1.6.0 * Since: 1.6.0
**/ **/
const gchar * 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); FuContextPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(FU_IS_CONTEXT(self), NULL); 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()"); g_critical("cannot use SMBIOS before calling ->load_hwinfo()");
return NULL; 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 * @self: a #FuContext
* @type: a structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS * @type: a structure type, e.g. %FU_SMBIOS_STRUCTURE_TYPE_BIOS
* @offset: a structure offset * @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. * 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 * Since: 1.6.0
**/ **/
guint 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); FuContextPrivate *priv = GET_PRIVATE(self);
g_return_val_if_fail(FU_IS_CONTEXT(self), G_MAXUINT); 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()"); g_critical("cannot use SMBIOS before calling ->load_hwinfo()");
return G_MAXUINT; return G_MAXUINT;
} }
return fu_smbios_get_integer(priv->smbios, type, offset, NULL); return fu_smbios_get_integer(priv->smbios, type, offset, error);
} }
/** /**

View File

@ -66,9 +66,9 @@ gboolean
fu_context_has_flag(FuContext *context, FuContextFlags flag); fu_context_has_flag(FuContext *context, FuContextFlags flag);
const gchar * 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 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 * GBytes *
fu_context_get_smbios_data(FuContext *self, guint8 structure_type, GError **error); fu_context_get_smbios_data(FuContext *self, guint8 structure_type, GError **error);
gboolean gboolean

View File

@ -6602,7 +6602,7 @@ static gchar *
fu_engine_attrs_calculate_hsi_for_chassis(FuEngine *self) fu_engine_attrs_calculate_hsi_for_chassis(FuEngine *self)
{ {
guint val = 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 emulating, force the chassis type to be valid */
if (self->host_emulation && if (self->host_emulation &&