From 8fc8539146ccd25c007dd9682632b923206f715f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 9 Dec 2021 23:12:11 +0000 Subject: [PATCH] trivial: Remove some unused variables --- plugins/dfu/fu-dfu-target.c | 2 -- plugins/fastboot/fu-fastboot-device.c | 1 - .../fu-logitech-bulkcontroller-common.c | 3 +++ .../fu-logitech-bulkcontroller-device.c | 1 - plugins/modem-manager/fu-plugin-modem-manager.c | 1 - plugins/realtek-mst/fu-realtek-mst-device.c | 3 --- plugins/redfish/fu-plugin-redfish.c | 1 - plugins/steelseries/fu-steelseries-gamepad.c | 1 - plugins/tpm/fu-plugin-tpm.c | 1 - plugins/tpm/fu-self-test.c | 4 ---- plugins/uefi-capsule/fu-plugin-uefi-capsule.c | 1 - src/fu-security-attr.c | 1 - src/fu-util.c | 4 +--- 13 files changed, 4 insertions(+), 20 deletions(-) diff --git a/plugins/dfu/fu-dfu-target.c b/plugins/dfu/fu-dfu-target.c index 157f8917f..c7120dbc6 100644 --- a/plugins/dfu/fu-dfu-target.c +++ b/plugins/dfu/fu-dfu-target.c @@ -879,7 +879,6 @@ fu_dfu_target_upload_element_dfu(FuDfuTarget *self, { FuDfuTargetPrivate *priv = GET_PRIVATE(self); GBytes *chunk_tmp; - guint32 offset = 0; guint percentage_size = expected_size > 0 ? expected_size : maximum_size; gsize total_size = 0; guint16 transfer_size = fu_dfu_device_get_transfer_size(priv->device); @@ -906,7 +905,6 @@ fu_dfu_target_upload_element_dfu(FuDfuTarget *self, /* keep a sum of all the chunks */ chunk_size = (guint32)g_bytes_get_size(chunk_tmp); total_size += chunk_size; - offset += chunk_size; /* add to array */ g_debug("got #%04x chunk of size %" G_GUINT32_FORMAT, idx, chunk_size); diff --git a/plugins/fastboot/fu-fastboot-device.c b/plugins/fastboot/fu-fastboot-device.c index 810195f6c..f983f260a 100644 --- a/plugins/fastboot/fu-fastboot-device.c +++ b/plugins/fastboot/fu-fastboot-device.c @@ -649,7 +649,6 @@ fu_fastboot_device_write_firmware(FuDevice *device, GError **error) { g_autoptr(FuFirmware) manifest = NULL; - g_autoptr(GBytes) fw = NULL; /* load the manifest of operations */ manifest = fu_firmware_get_image_by_id(firmware, "partition_nand.xml", NULL); diff --git a/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-common.c b/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-common.c index 4934ac8b8..730c9d271 100644 --- a/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-common.c +++ b/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-common.c @@ -73,8 +73,11 @@ GByteArray * proto_manager_generate_set_device_time_request(void) { GByteArray *buf = g_byte_array_new(); +#if GLIB_CHECK_VERSION(2, 57, 1) g_autoptr(GTimeZone) tz = g_time_zone_new_local(); +#else g_autoptr(GDateTime) dt = g_date_time_new_now_utc(); +#endif Logi__Device__Proto__Header header_msg = LOGI__DEVICE__PROTO__HEADER__INIT; Logi__Device__Proto__SetDeviceTimeRequest set_devicetime_msg = diff --git a/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-device.c b/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-device.c index 6594a774d..78974e339 100644 --- a/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-device.c +++ b/plugins/logitech-bulkcontroller/fu-logitech-bulkcontroller-device.c @@ -311,7 +311,6 @@ fu_logitech_bulkcontroller_device_send_sync_cmd(FuLogitechBulkcontrollerDevice * GError **error) { g_autoptr(GByteArray) buf_pkt = g_byte_array_new(); - g_autoptr(GByteArray) buf_ack = g_byte_array_new(); fu_byte_array_append_uint32(buf_pkt, cmd, G_LITTLE_ENDIAN); /* Type(T) : Command type */ fu_byte_array_append_uint32(buf_pkt, diff --git a/plugins/modem-manager/fu-plugin-modem-manager.c b/plugins/modem-manager/fu-plugin-modem-manager.c index abd8372ac..d7f8cd55d 100644 --- a/plugins/modem-manager/fu-plugin-modem-manager.c +++ b/plugins/modem-manager/fu-plugin-modem-manager.c @@ -119,7 +119,6 @@ fu_plugin_mm_udev_device_port_added(FuPlugin *plugin, FuPluginData *priv = fu_plugin_get_data(plugin); FuMmDevice *existing; g_autoptr(FuMmDevice) dev = NULL; - g_autoptr(GError) error = NULL; g_return_if_fail(priv->inhibited != NULL); existing = fu_plugin_cache_lookup(plugin, priv->inhibited->physical_id); diff --git a/plugins/realtek-mst/fu-realtek-mst-device.c b/plugins/realtek-mst/fu-realtek-mst-device.c index c2d3b44ed..165f2f208 100644 --- a/plugins/realtek-mst/fu-realtek-mst-device.c +++ b/plugins/realtek-mst/fu-realtek-mst-device.c @@ -659,7 +659,6 @@ flash_iface_write(FuRealtekMstDevice *self, FuProgress *progress, GError **error) { - gsize bytes_written = 0; gsize total_size = g_bytes_get_size(data); g_autoptr(GPtrArray) chunks = fu_chunk_array_new_from_bytes(data, address, 0, 256); @@ -711,8 +710,6 @@ flash_iface_write(FuRealtekMstDevice *self, address); return FALSE; } - - bytes_written += chunk_size; fu_progress_set_percentage_full(progress, i + 1, chunks->len); } diff --git a/plugins/redfish/fu-plugin-redfish.c b/plugins/redfish/fu-plugin-redfish.c index 532a03767..2b6fc8c88 100644 --- a/plugins/redfish/fu-plugin-redfish.c +++ b/plugins/redfish/fu-plugin-redfish.c @@ -212,7 +212,6 @@ fu_redfish_plugin_ipmi_create_user(FuPlugin *plugin, GError **error) g_autoptr(FuDeviceLocker) locker = NULL; g_autoptr(FuIpmiDevice) device = fu_ipmi_device_new(fu_plugin_get_context(plugin)); g_autoptr(FuRedfishRequest) request = NULL; - g_autoptr(GError) error_local = NULL; g_autoptr(JsonBuilder) builder = json_builder_new(); /* create device */ diff --git a/plugins/steelseries/fu-steelseries-gamepad.c b/plugins/steelseries/fu-steelseries-gamepad.c index b8782b18f..4665f6f1e 100644 --- a/plugins/steelseries/fu-steelseries-gamepad.c +++ b/plugins/steelseries/fu-steelseries-gamepad.c @@ -184,7 +184,6 @@ fu_steelseries_gamepad_setup(FuDevice *device, GError **error) { g_autofree gchar *bootloader_version = NULL; g_autofree gchar *version = NULL; - g_autofree gchar *tmp = NULL; guint16 fw_ver; guint8 data[STEELSERIES_BUFFER_CONTROL_SIZE] = {0}; diff --git a/plugins/tpm/fu-plugin-tpm.c b/plugins/tpm/fu-plugin-tpm.c index 8fe9b1486..b658bf9c4 100644 --- a/plugins/tpm/fu-plugin-tpm.c +++ b/plugins/tpm/fu-plugin-tpm.c @@ -43,7 +43,6 @@ static void fu_plugin_tpm_set_bios_pcr0s(FuPlugin *plugin) { FuPluginData *data = fu_plugin_get_data(plugin); - g_autoptr(GError) error_local = NULL; g_autoptr(GPtrArray) pcr0s = NULL; if (data->tpm_device == NULL) diff --git a/plugins/tpm/fu-self-test.c b/plugins/tpm/fu-self-test.c index b9d309cf1..665dd9e20 100644 --- a/plugins/tpm/fu-self-test.c +++ b/plugins/tpm/fu-self-test.c @@ -126,7 +126,6 @@ fu_tpm_eventlog_parse_v1_func(void) g_autoptr(GPtrArray) items = NULL; g_autoptr(GError) error = NULL; g_autoptr(GPtrArray) pcr0s = NULL; - g_autoptr(FuContext) ctx = fu_context_new(); fn = g_test_build_filename(G_TEST_DIST, "tests", "binary_bios_measurements-v1", NULL); if (!g_file_test(fn, G_FILE_TEST_EXISTS) && ci == NULL) { @@ -161,7 +160,6 @@ fu_tpm_eventlog_parse_v2_func(void) g_autoptr(GPtrArray) items = NULL; g_autoptr(GError) error = NULL; g_autoptr(GPtrArray) pcr0s = NULL; - g_autoptr(FuContext) ctx = fu_context_new(); fn = g_test_build_filename(G_TEST_DIST, "tests", "binary_bios_measurements-v2", NULL); if (!g_file_test(fn, G_FILE_TEST_EXISTS) && ci == NULL) { @@ -200,8 +198,6 @@ fu_tpm_empty_pcr_func(void) g_autoptr(FuSecurityAttrs) attrs = fu_security_attrs_new(); g_autoptr(FwupdSecurityAttr) attr = NULL; g_autoptr(GError) error = NULL; - g_autoptr(GPtrArray) pcr0s = NULL; - g_autoptr(GPtrArray) pcrXs = NULL; /* do not save silo */ ret = fu_context_load_quirks(ctx, FU_QUIRKS_LOAD_FLAG_NO_CACHE, &error); diff --git a/plugins/uefi-capsule/fu-plugin-uefi-capsule.c b/plugins/uefi-capsule/fu-plugin-uefi-capsule.c index 3d910f7b6..8e72974e0 100644 --- a/plugins/uefi-capsule/fu-plugin-uefi-capsule.c +++ b/plugins/uefi-capsule/fu-plugin-uefi-capsule.c @@ -518,7 +518,6 @@ fu_plugin_uefi_capsule_startup(FuPlugin *plugin, GError **error) g_autofree gchar *esp_path = NULL; g_autofree gchar *nvram_total_str = NULL; g_autoptr(GError) error_local = NULL; - g_autoptr(GError) error_fde = NULL; /* don't let user's environment influence test suite failures */ if (g_getenv("FWUPD_UEFI_TEST") != NULL) diff --git a/src/fu-security-attr.c b/src/fu-security-attr.c index 9dd39d4ec..c5913f009 100644 --- a/src/fu-security-attr.c +++ b/src/fu-security-attr.c @@ -315,7 +315,6 @@ void fu_security_attrs_to_json(FuSecurityAttrs *attrs, JsonBuilder *builder) { g_autoptr(GPtrArray) items = NULL; - g_autoptr(GError) error = NULL; json_builder_begin_object(builder); json_builder_set_member_name(builder, "SecurityAttributes"); diff --git a/src/fu-util.c b/src/fu-util.c index 9dca39c72..87268725c 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -1010,11 +1010,9 @@ fu_util_device_test(FuUtilPrivate *priv, gchar **values, GError **error) json_builder_set_member_name(builder, "results"); json_builder_begin_array(builder); for (guint i = 0; values[i] != NULL; i++) { - g_autoptr(GError) error_local = NULL; json_builder_begin_object(builder); - if (!fu_util_device_test_filename(priv, &helper, values[i], error)) { + if (!fu_util_device_test_filename(priv, &helper, values[i], error)) return FALSE; - } json_builder_end_object(builder); } json_builder_end_array(builder);