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.
This commit is contained in:
Richard Hughes 2022-06-29 10:09:02 +01:00
parent ac55012001
commit c1fc8a55e0
12 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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};

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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) ||

View File

@ -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))

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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++) {