From 3d65399626bab410b5b5c2d47bb802bde7903e7c Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 17 Oct 2019 22:00:03 -0500 Subject: [PATCH] trivial: coreboot: fix a clang compiler error ``` ../plugins/coreboot/fu-plugin-coreboot.c:96:7: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] name = fu_plugin_coreboot_get_name_for_type (plugin, NULL); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../plugins/coreboot/fu-plugin-coreboot.c:98:8: error: assigning to 'gchar *' (aka 'char *') from 'const gchar *' (aka 'const char *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] name = fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_PRODUCT_NAME); ``` --- plugins/coreboot/fu-coreboot-common.c | 7 +++---- plugins/coreboot/fu-plugin-coreboot.c | 12 +++++++----- plugins/coreboot/fu-plugin-coreboot.h | 7 +++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/coreboot/fu-coreboot-common.c b/plugins/coreboot/fu-coreboot-common.c index 5913922bb..19202a13b 100644 --- a/plugins/coreboot/fu-coreboot-common.c +++ b/plugins/coreboot/fu-coreboot-common.c @@ -12,9 +12,8 @@ #include "fu-plugin-coreboot.h" /* Tries to convert the coreboot version string to a triplet string. - * Returns NULL on error. - */ -const gchar * + * Returns NULL on error. */ +gchar * fu_plugin_coreboot_version_string_to_triplet (const gchar *coreboot_version, GError **error) { @@ -47,7 +46,7 @@ fu_plugin_coreboot_version_string_to_triplet (const gchar *coreboot_version, } /* convert firmware type to user friendly string representation */ -const gchar* +gchar * fu_plugin_coreboot_get_name_for_type (FuPlugin *plugin, const gchar *vboot_partition) { diff --git a/plugins/coreboot/fu-plugin-coreboot.c b/plugins/coreboot/fu-plugin-coreboot.c index e753dcda2..fe75d79d5 100644 --- a/plugins/coreboot/fu-plugin-coreboot.c +++ b/plugins/coreboot/fu-plugin-coreboot.c @@ -25,14 +25,14 @@ fu_plugin_init (FuPlugin *plugin) gboolean fu_plugin_coldplug (FuPlugin *plugin, GError **error) { - g_autofree const gchar *triplet = NULL; - g_autofree gchar *name = NULL; const gchar *major; const gchar *minor; const gchar *vendor; const gchar *version; GBytes *bios_table; gboolean updatable = FALSE; /* TODO: Implement update support */ + g_autofree gchar *name = NULL; + g_autofree gchar *triplet = NULL; g_autoptr(FuDevice) dev = NULL; /* don't inlcude FU_HWIDS_KEY_BIOS_VERSION */ @@ -94,9 +94,11 @@ fu_plugin_coldplug (FuPlugin *plugin, GError **error) fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL); fu_device_add_icon (dev, "computer"); name = fu_plugin_coreboot_get_name_for_type (plugin, NULL); - if (name == NULL) - name = fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_PRODUCT_NAME); - fu_device_set_name (dev, name); + if (name != NULL) { + fu_device_set_name (dev, name); + } else { + fu_device_set_name (dev, fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_PRODUCT_NAME)); + } fu_device_set_vendor (dev, fu_plugin_get_dmi_value (plugin, FU_HWIDS_KEY_MANUFACTURER)); fu_device_add_instance_id (dev, "main-system-firmware"); diff --git a/plugins/coreboot/fu-plugin-coreboot.h b/plugins/coreboot/fu-plugin-coreboot.h index 3f1cf9772..e6260f6e4 100644 --- a/plugins/coreboot/fu-plugin-coreboot.h +++ b/plugins/coreboot/fu-plugin-coreboot.h @@ -9,8 +9,7 @@ #include "fu-plugin.h" #include "fu-device.h" -const gchar * fu_plugin_coreboot_version_string_to_triplet (const gchar *coreboot_version, +gchar *fu_plugin_coreboot_version_string_to_triplet (const gchar *coreboot_version, GError **error); - -const gchar* fu_plugin_coreboot_get_name_for_type (FuPlugin *plugin, - const gchar *vboot_partition); +gchar *fu_plugin_coreboot_get_name_for_type (FuPlugin *plugin, + const gchar *vboot_partition);