From c1fc8a55e0035161354ed4ee6d7e3fb99e273e1f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 29 Jun 2022 10:09:02 +0100 Subject: [PATCH] Always set the progress ID when setting the number of steps This fixes a potential critical warning (seen in the hailuck plugin, although others may be affected too) where the parent does not set the ID before the child sets the number of steps. It's much more helpful to have the child position for debugging anyway, so just set it in all cases. --- plugins/ata/fu-ata-device.c | 1 + plugins/bcm57xx/fu-bcm57xx-recovery-device.c | 2 ++ plugins/dfu-csr/fu-dfu-csr-device.c | 1 + plugins/fastboot/fu-fastboot-device.c | 1 + plugins/hailuck/fu-hailuck-bl-device.c | 1 + plugins/superio/fu-superio-it55-device.c | 1 + plugins/superio/fu-superio-it89-device.c | 1 + plugins/synaptics-mst/fu-synaptics-mst-device.c | 1 + plugins/synaptics-rmi/fu-synaptics-rmi-v7-device.c | 1 + plugins/vli/fu-vli-device.c | 2 ++ plugins/vli/fu-vli-pd-parade-device.c | 1 + plugins/vli/fu-vli-usbhub-msp430-device.c | 1 + 12 files changed, 14 insertions(+) diff --git a/plugins/ata/fu-ata-device.c b/plugins/ata/fu-ata-device.c index 9d09f0d82..b8600636f 100644 --- a/plugins/ata/fu-ata-device.c +++ b/plugins/ata/fu-ata-device.c @@ -816,6 +816,7 @@ fu_ata_device_write_firmware(FuDevice *device, /* write each block */ fu_progress_set_status(progress, FWUPD_STATUS_DEVICE_WRITE); chunks = fu_chunk_array_new_from_bytes(fw, 0x00, 0x00, chunksz); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); diff --git a/plugins/bcm57xx/fu-bcm57xx-recovery-device.c b/plugins/bcm57xx/fu-bcm57xx-recovery-device.c index 18f9cf62c..ef150cfed 100644 --- a/plugins/bcm57xx/fu-bcm57xx-recovery-device.c +++ b/plugins/bcm57xx/fu-bcm57xx-recovery-device.c @@ -344,6 +344,7 @@ fu_bcm57xx_recovery_device_nvram_read(FuBcm57xxRecoveryDevice *self, FuProgress *progress, GError **error) { + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, bufsz); for (guint i = 0; i < bufsz; i++) { BcmRegNVMCommand tmp = {0}; @@ -406,6 +407,7 @@ fu_bcm57xx_recovery_device_nvram_write(FuBcm57xxRecoveryDevice *self, return FALSE; } + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, bufsz_dwrds); for (guint i = 0; i < bufsz_dwrds; i++) { BcmRegNVMCommand tmp = {0}; diff --git a/plugins/dfu-csr/fu-dfu-csr-device.c b/plugins/dfu-csr/fu-dfu-csr-device.c index 05d36362c..ed6c38e8e 100644 --- a/plugins/dfu-csr/fu-dfu-csr-device.c +++ b/plugins/dfu-csr/fu-dfu-csr-device.c @@ -379,6 +379,7 @@ fu_dfu_csr_device_download(FuDevice *device, } /* send to hardware */ + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (idx = 0; idx < chunks->len; idx++) { FuChunk *chk = g_ptr_array_index(chunks, idx); diff --git a/plugins/fastboot/fu-fastboot-device.c b/plugins/fastboot/fu-fastboot-device.c index c2d866e3b..a36226cd5 100644 --- a/plugins/fastboot/fu-fastboot-device.c +++ b/plugins/fastboot/fu-fastboot-device.c @@ -288,6 +288,7 @@ fu_fastboot_device_download(FuDevice *device, GBytes *fw, FuProgress *progress, 0x00, /* start addr */ 0x00, /* page_sz */ self->blocksz); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); diff --git a/plugins/hailuck/fu-hailuck-bl-device.c b/plugins/hailuck/fu-hailuck-bl-device.c index ed4179b6f..fc60127ff 100644 --- a/plugins/hailuck/fu-hailuck-bl-device.c +++ b/plugins/hailuck/fu-hailuck-bl-device.c @@ -114,6 +114,7 @@ fu_hailuck_bl_device_dump_firmware(FuDevice *device, FuProgress *progress, GErro /* receive data back */ fu_byte_array_set_size(fwbuf, fwsz, 0x00); chunks = fu_chunk_array_mutable_new(fwbuf->data, fwbuf->len, 0x0, 0x0, 2048); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); diff --git a/plugins/superio/fu-superio-it55-device.c b/plugins/superio/fu-superio-it55-device.c index ee806c8e0..4f276eb34 100644 --- a/plugins/superio/fu-superio-it55-device.c +++ b/plugins/superio/fu-superio-it55-device.c @@ -237,6 +237,7 @@ fu_superio_it55_device_get_firmware(FuDevice *device, FuProgress *progress, GErr g_autofree guint8 *buf = NULL; buf = g_malloc0(fwsize); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, block_count); for (guint i = 0; i < block_count; ++i) { if (!fu_superio_device_ec_write_cmd(self, SIO_CMD_EC_READ_BLOCK, error) || diff --git a/plugins/superio/fu-superio-it89-device.c b/plugins/superio/fu-superio-it89-device.c index 77b280e54..7a7779a30 100644 --- a/plugins/superio/fu-superio-it89-device.c +++ b/plugins/superio/fu-superio-it89-device.c @@ -254,6 +254,7 @@ fu_superio_it89_device_read_addr(FuSuperioDevice *self, /* read out data */ buf = g_malloc0(size); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, size); for (guint i = 0; i < size; i++) { if (!fu_superio_device_ec_write_cmd(self, SIO_EC_PMC_PM1DI, error)) diff --git a/plugins/synaptics-mst/fu-synaptics-mst-device.c b/plugins/synaptics-mst/fu-synaptics-mst-device.c index 22ea1d9fa..acaec8214 100644 --- a/plugins/synaptics-mst/fu-synaptics-mst-device.c +++ b/plugins/synaptics-mst/fu-synaptics-mst-device.c @@ -345,6 +345,7 @@ fu_synaptics_mst_device_update_esm(FuSynapticsMstDevice *self, g_usleep(FLASH_SETTLE_TIME); /* write firmware */ + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, write_loops); for (guint32 i = 0; i < write_loops; i++) { g_autoptr(GError) error_local = NULL; diff --git a/plugins/synaptics-rmi/fu-synaptics-rmi-v7-device.c b/plugins/synaptics-rmi/fu-synaptics-rmi-v7-device.c index df2ad7307..3d86bd2c7 100644 --- a/plugins/synaptics-rmi/fu-synaptics-rmi-v7-device.c +++ b/plugins/synaptics-rmi/fu-synaptics-rmi-v7-device.c @@ -294,6 +294,7 @@ fu_synaptics_rmi_v7_device_write_partition(FuSynapticsRmiDevice *self, 0x00, /* start addr */ 0x00, /* page_sz */ (gsize)flash->payload_length * (gsize)flash->block_size); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); diff --git a/plugins/vli/fu-vli-device.c b/plugins/vli/fu-vli-device.c index 6dd830ebf..fcab021dd 100644 --- a/plugins/vli/fu-vli-device.c +++ b/plugins/vli/fu-vli-device.c @@ -217,6 +217,7 @@ fu_vli_device_spi_read(FuVliDevice *self, /* get data from hardware */ chunks = fu_chunk_array_mutable_new(buf, bufsz, address, 0x0, FU_VLI_DEVICE_TXSIZE); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); @@ -385,6 +386,7 @@ fu_vli_device_spi_erase(FuVliDevice *self, { g_autoptr(GPtrArray) chunks = fu_chunk_array_new(NULL, sz, addr, 0x0, 0x1000); g_debug("erasing 0x%x bytes @0x%x", (guint)sz, addr); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, chunks->len); for (guint i = 0; i < chunks->len; i++) { FuChunk *chk = g_ptr_array_index(chunks, i); diff --git a/plugins/vli/fu-vli-pd-parade-device.c b/plugins/vli/fu-vli-pd-parade-device.c index 2459b65e7..85d823c7e 100644 --- a/plugins/vli/fu-vli-pd-parade-device.c +++ b/plugins/vli/fu-vli-pd-parade-device.c @@ -653,6 +653,7 @@ fu_vli_pd_parade_device_dump_firmware(FuDevice *device, FuProgress *progress, GE fu_progress_set_status(progress, FWUPD_STATUS_DEVICE_VERIFY); fu_byte_array_set_size(fw, fu_device_get_firmware_size_max(device), 0x00); blocks = fu_chunk_array_mutable_new(fw->data, fw->len, 0x0, 0x0, 0x10000); + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_steps(progress, blocks->len); for (guint i = 0; i < blocks->len; i++) { FuChunk *chk = g_ptr_array_index(blocks, i); diff --git a/plugins/vli/fu-vli-usbhub-msp430-device.c b/plugins/vli/fu-vli-usbhub-msp430-device.c index f67199cb1..fe10a7c38 100644 --- a/plugins/vli/fu-vli-usbhub-msp430-device.c +++ b/plugins/vli/fu-vli-usbhub-msp430-device.c @@ -226,6 +226,7 @@ fu_vli_usbhub_msp430_device_write_firmware(FuDevice *device, return FALSE; /* transfer by I²C write, and check status by I²C read */ + fu_progress_set_id(progress, G_STRLOC); fu_progress_set_status(progress, FWUPD_STATUS_DEVICE_WRITE); fu_progress_set_steps(progress, records->len); for (guint j = 0; j < records->len; j++) {