diff options
46 files changed, 97 insertions, 188 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ab36fbfa0c..375e29fb69 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3116,8 +3116,7 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v, Error *error = NULL; int64_t value; - visit_type_int(v, name, &value, &error); - if (error) { + if (!visit_type_int(v, name, &value, &error)) { error_propagate(errp, error); return; } diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 3b4fda5640..d6b3d7fc07 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -185,8 +185,7 @@ static void tcg_set_tb_size(Object *obj, Visitor *v, Error *error = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &error); - if (error) { + if (!visit_type_uint32(v, name, &value, &error)) { error_propagate(errp, error); return; } diff --git a/backends/cryptodev.c b/backends/cryptodev.c index a3841c4e41..7e7265102e 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -157,8 +157,7 @@ cryptodev_backend_set_queues(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (!value) { diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index cdabb412e6..320dffbaa9 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -119,8 +119,7 @@ static void file_memory_backend_set_align(Object *o, Visitor *v, goto out; } - visit_type_size(v, name, &val, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &val, &local_err)) { goto out; } fb->align = val; diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 1b5e4bfe0d..d4281c0032 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -85,8 +85,7 @@ memfd_backend_set_hugetlbsize(Object *obj, Visitor *v, const char *name, goto out; } - visit_type_size(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &value, &local_err)) { goto out; } if (!value) { diff --git a/backends/hostmem.c b/backends/hostmem.c index 61e3255f5c..4e4103ac09 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -63,8 +63,7 @@ host_memory_backend_set_size(Object *obj, Visitor *v, const char *name, goto out; } - visit_type_size(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &value, &local_err)) { goto out; } if (!value) { @@ -257,8 +256,7 @@ static void host_memory_backend_set_prealloc_threads(Object *obj, Visitor *v, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (value <= 0) { diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c index cfc7572a61..971f3af047 100644 --- a/backends/tpm/tpm_util.c +++ b/backends/tpm/tpm_util.c @@ -58,8 +58,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/block/blkdebug.c b/block/blkdebug.c index d473dcf8c7..3c0a9d45cc 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -375,8 +375,7 @@ static int blkdebug_parse_perm_list(uint64_t *dest, QDict *options, } v = qobject_input_visitor_new(crumpled_subqdict); - visit_type_BlockPermissionList(v, NULL, &perm_list, &local_err); - if (local_err) { + if (!visit_type_BlockPermissionList(v, NULL, &perm_list, &local_err)) { error_propagate(errp, local_err); ret = -EINVAL; goto out; diff --git a/block/nbd.c b/block/nbd.c index 1b30d96a4f..1331307ffb 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -1739,8 +1739,7 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, goto done; } - visit_type_SocketAddress(iv, NULL, &saddr, &local_err); - if (local_err) { + if (!visit_type_SocketAddress(iv, NULL, &saddr, &local_err)) { error_propagate(errp, local_err); goto done; } diff --git a/block/sheepdog.c b/block/sheepdog.c index a8d396dcdf..e3bcb05f60 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -541,8 +541,7 @@ static SocketAddress *sd_server_config(QDict *options, Error **errp) goto done; } - visit_type_SocketAddress(iv, NULL, &saddr, &local_err); - if (local_err) { + if (!visit_type_SocketAddress(iv, NULL, &saddr, &local_err)) { error_propagate(errp, local_err); goto done; } diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 784fa4a16c..bb242fde1a 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -823,8 +823,7 @@ static void throttle_group_set(Object *obj, Visitor *v, const char * name, goto ret; } - visit_type_int64(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int64(v, name, &value, &local_err)) { goto ret; } if (value < 0) { @@ -896,8 +895,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, ThrottleLimits *argp; Error *local_err = NULL; - visit_type_ThrottleLimits(v, name, &argp, &local_err); - if (local_err) { + if (!visit_type_ThrottleLimits(v, name, &argp, &local_err)) { goto ret; } qemu_mutex_lock(&tg->lock); diff --git a/bootdevice.c b/bootdevice.c index 0ff55e2b79..fb09d3c668 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -297,8 +297,7 @@ static void device_set_bootindex(Object *obj, Visitor *v, const char *name, int32_t boot_index; Error *local_err = NULL; - visit_type_int32(v, name, &boot_index, &local_err); - if (local_err) { + if (!visit_type_int32(v, name, &boot_index, &local_err)) { goto out; } /* check whether bootindex is present in fw_boot_order list */ diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 10c44dfda2..48890536a4 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -412,8 +412,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/core/machine.c b/hw/core/machine.c index 211b4e077a..7ff0af93ef 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -293,8 +293,7 @@ static void machine_set_phandle_start(Object *obj, Visitor *v, Error *error = NULL; int64_t value; - visit_type_int(v, name, &value, &error); - if (error) { + if (!visit_type_int(v, name, &value, &error)) { error_propagate(errp, error); return; } diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 38b0c9f09b..383a54578f 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -92,8 +92,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -238,8 +237,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -316,8 +314,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -398,8 +395,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ca7771f307..3cb6faa12b 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -125,8 +125,7 @@ static void prop_set_bit(Object *obj, Visitor *v, const char *name, return; } - visit_type_bool(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -189,8 +188,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, const char *name, return; } - visit_type_bool(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -486,8 +484,7 @@ static void set_string(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -540,8 +537,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -762,8 +758,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_free(local_err); local_err = NULL; visit_type_int32(v, name, &value, &local_err); @@ -844,8 +839,7 @@ static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_size(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -894,8 +888,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name, return; } - visit_type_size(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -976,8 +969,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -1076,8 +1068,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } @@ -1158,8 +1149,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name, name); return; } - visit_type_uint32(v, name, alenptr, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, alenptr, &local_err)) { error_propagate(errp, local_err); return; } @@ -1490,8 +1480,8 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name, return; } - visit_type_enum(v, prop->name, &speed, prop->info->enum_table, &local_err); - if (local_err) { + if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table, + &local_err)) { error_propagate(errp, local_err); return; } @@ -1578,8 +1568,8 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name, return; } - visit_type_enum(v, prop->name, &width, prop->info->enum_table, &local_err); - if (local_err) { + if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table, + &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/cpu/core.c b/hw/cpu/core.c index a92ac597ca..d9857031ca 100644 --- a/hw/cpu/core.c +++ b/hw/cpu/core.c @@ -31,8 +31,7 @@ static void core_prop_set_core_id(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -61,8 +60,7 @@ static void core_prop_set_nr_threads(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c index dfa9db3d33..3310fe62fe 100644 --- a/hw/gpio/aspeed_gpio.c +++ b/hw/gpio/aspeed_gpio.c @@ -762,8 +762,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name, AspeedGPIOState *s = ASPEED_GPIO(obj); int set_idx, group_idx = 0; - visit_type_bool(v, name, &level, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &level, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d7f27bc16b..cb15261420 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1862,8 +1862,7 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, Error *error = NULL; uint64_t value; - visit_type_size(v, name, &value, &error); - if (error) { + if (!visit_type_size(v, name, &value, &error)) { error_propagate(errp, error); return; } diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index f68fbee93d..358f10a92e 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -245,8 +245,7 @@ static void ide_dev_set_bootindex(Object *obj, Visitor *v, const char *name, int32_t boot_index; Error *local_err = NULL; - visit_type_int32(v, name, &boot_index, &local_err); - if (local_err) { + if (!visit_type_int32(v, name, &boot_index, &local_err)) { goto out; } /* check whether bootindex is present in fw_boot_order list */ diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 7da2862b3d..76c3f78e11 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -428,8 +428,7 @@ static void apic_common_set_id(Object *obj, Visitor *v, const char *name, return; } - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 76f66e0b19..ec92ffd415 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -53,8 +53,7 @@ static void nvdimm_set_label_size(Object *obj, Visitor *v, const char *name, goto out; } - visit_type_size(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &value, &local_err)) { goto out; } if (value < MIN_NAMESPACE_LABEL_SIZE) { @@ -89,8 +88,7 @@ static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; char *value; - visit_type_str(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &value, &local_err)) { goto out; } diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 25e1e58356..28874445c3 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -227,8 +227,7 @@ static void aspeed_sdmc_set_ram_size(Object *obj, Visitor *v, const char *name, AspeedSDMCState *s = ASPEED_SDMC(obj); AspeedSDMCClass *asc = ASPEED_SDMC_GET_CLASS(s); - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c index 68b574d084..d2b99fc706 100644 --- a/hw/misc/pca9552.c +++ b/hw/misc/pca9552.c @@ -296,8 +296,7 @@ static void pca955x_set_led(Object *obj, Visitor *v, const char *name, uint8_t state; char *state_str; - visit_type_str(v, name, &state_str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &state_str, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index 58dbebca90..2ae0b899be 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -75,8 +75,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; int64_t temp; - visit_type_int(v, name, &temp, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &temp, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index 74864cd93d..9473382bd5 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -147,8 +147,7 @@ static void tmp421_set_temperature(Object *obj, Visitor *v, const char *name, int offset = ext_range * 64 * 256; int tempid; - visit_type_int(v, name, &temp, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &temp, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index fdf8faa0d9..765bcd1f0b 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -113,8 +113,7 @@ static void isa_ne2000_set_bootindex(Object *obj, Visitor *v, int32_t boot_index; Error *local_err = NULL; - visit_type_int32(v, name, &boot_index, &local_err); - if (local_err) { + if (!visit_type_int32(v, name, &boot_index, &local_err)) { goto out; } /* check whether bootindex is present in fw_boot_order list */ diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 0c2bc8e06e..52be86e49c 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -88,8 +88,7 @@ static void spapr_cap_set_bool(Object *obj, Visitor *v, const char *name, bool value; Error *local_err = NULL; - visit_type_bool(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -127,8 +126,7 @@ static void spapr_cap_set_string(Object *obj, Visitor *v, const char *name, uint8_t i; char *val; - visit_type_str(v, name, &val, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &val, &local_err)) { error_propagate(errp, local_err); return; } @@ -171,8 +169,7 @@ static void spapr_cap_set_pagesize(Object *obj, Visitor *v, const char *name, uint8_t val; Error *local_err = NULL; - visit_type_size(v, name, &pagesize, &local_err); - if (local_err) { + if (!visit_type_size(v, name, &pagesize, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 951bcdf2c0..d10193f39e 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -327,8 +327,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name, case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); - visit_start_struct(v, name, NULL, 0, &err); - if (err) { + if (!visit_start_struct(v, name, NULL, 0, &err)) { error_propagate(errp, err); return; } @@ -348,14 +347,13 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name, int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); - visit_start_list(v, name, NULL, 0, &err); - if (err) { + if (!visit_start_list(v, name, NULL, 0, &err)) { error_propagate(errp, err); return; } for (i = 0; i < prop_len; i++) { - visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], &err); - if (err) { + if (!visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], + &err)) { error_propagate(errp, err); return; } diff --git a/hw/s390x/css.c b/hw/s390x/css.c index d1e365e3e6..ab28b2fb30 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -2387,8 +2387,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name, return; } - visit_type_str(v, name, &str, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &str, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index f5977eb72e..1c3bd2578c 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -736,8 +736,7 @@ static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *name, int32_t boot_index; Error *local_err = NULL; - visit_type_int32(v, name, &boot_index, &local_err); - if (local_err) { + if (!visit_type_int32(v, name, &boot_index, &local_err)) { goto out; } /* check whether bootindex is present in fw_boot_order list */ diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index d304c81148..1467b8034e 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1509,8 +1509,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v, return; } - visit_type_uint8(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint8(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index ae31f0817a..277747f4f1 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -239,22 +239,18 @@ static void balloon_stats_get_all(Object *obj, Visitor *v, const char *name, VirtIOBalloon *s = opaque; int i; - visit_start_struct(v, name, NULL, 0, &err); - if (err) { + if (!visit_start_struct(v, name, NULL, 0, &err)) { goto out; } - visit_type_int(v, "last-update", &s->stats_last_update, &err); - if (err) { + if (!visit_type_int(v, "last-update", &s->stats_last_update, &err)) { goto out_end; } - visit_start_struct(v, "stats", NULL, 0, &err); - if (err) { + if (!visit_start_struct(v, "stats", NULL, 0, &err)) { goto out_end; } for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) { - visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], &err); - if (err) { + if (!visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], &err)) { goto out_nested; } } @@ -287,8 +283,7 @@ static void balloon_stats_set_poll_interval(Object *obj, Visitor *v, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/iothread.c b/iothread.c index cb082b9b26..cb65ef0e56 100644 --- a/iothread.c +++ b/iothread.c @@ -243,8 +243,7 @@ static void iothread_set_poll_param(Object *obj, Visitor *v, Error *local_err = NULL; int64_t value; - visit_type_int64(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int64(v, name, &value, &local_err)) { goto out; } diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index bb17b1b96c..ae4b6a4246 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1355,8 +1355,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict) break; case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: p->has_xbzrle_cache_size = true; - visit_type_size(v, param, &cache_size, &err); - if (err) { + if (!visit_type_size(v, param, &cache_size, &err)) { break; } if (cache_size > INT64_MAX || (size_t)cache_size != cache_size) { diff --git a/net/colo-compare.c b/net/colo-compare.c index f15779dedc..6835d42363 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1096,8 +1096,7 @@ static void compare_set_timeout(Object *obj, Visitor *v, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (!value) { @@ -1129,8 +1128,7 @@ static void compare_set_expired_scan_cycle(Object *obj, Visitor *v, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (!value) { diff --git a/net/dump.c b/net/dump.c index 61389e7dad..8c487a5590 100644 --- a/net/dump.c +++ b/net/dump.c @@ -195,8 +195,7 @@ static void filter_dump_set_maxlen(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (value == 0) { diff --git a/net/filter-buffer.c b/net/filter-buffer.c index 93050f86cf..8e42934b37 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -173,8 +173,7 @@ static void filter_buffer_set_interval(Object *obj, Visitor *v, Error *local_err = NULL; uint32_t value; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { goto out; } if (!value) { diff --git a/qom/object.c b/qom/object.c index 34daaf1280..0213e87c86 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2094,8 +2094,7 @@ static void property_set_str(Object *obj, Visitor *v, const char *name, char *value; Error *local_err = NULL; - visit_type_str(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -2175,8 +2174,7 @@ static void property_set_bool(Object *obj, Visitor *v, const char *name, bool value; Error *local_err = NULL; - visit_type_bool(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -2248,8 +2246,7 @@ static void property_set_enum(Object *obj, Visitor *v, const char *name, int value; Error *err = NULL; - visit_type_enum(v, name, &value, prop->lookup, &err); - if (err) { + if (!visit_type_enum(v, name, &value, prop->lookup, &err)) { error_propagate(errp, err); return; } @@ -2319,32 +2316,25 @@ static void property_get_tm(Object *obj, Visitor *v, const char *name, goto out; } - visit_start_struct(v, name, NULL, 0, &err); - if (err) { + if (!visit_start_struct(v, name, NULL, 0, &err)) { goto out; } - visit_type_int32(v, "tm_year", &value.tm_year, &err); - if (err) { + if (!visit_type_int32(v, "tm_year", &value.tm_year, &err)) { goto out_end; } - visit_type_int32(v, "tm_mon", &value.tm_mon, &err); - if (err) { + if (!visit_type_int32(v, "tm_mon", &value.tm_mon, &err)) { goto out_end; } - visit_type_int32(v, "tm_mday", &value.tm_mday, &err); - if (err) { + if (!visit_type_int32(v, "tm_mday", &value.tm_mday, &err)) { goto out_end; } - visit_type_int32(v, "tm_hour", &value.tm_hour, &err); - if (err) { + if (!visit_type_int32(v, "tm_hour", &value.tm_hour, &err)) { goto out_end; } - visit_type_int32(v, "tm_min", &value.tm_min, &err); - if (err) { + if (!visit_type_int32(v, "tm_min", &value.tm_min, &err)) { goto out_end; } - visit_type_int32(v, "tm_sec", &value.tm_sec, &err); - if (err) { + if (!visit_type_int32(v, "tm_sec", &value.tm_sec, &err)) { goto out_end; } visit_check_struct(v, &err); @@ -2408,8 +2398,7 @@ static void property_set_uint8_ptr(Object *obj, Visitor *v, const char *name, uint8_t value; Error *local_err = NULL; - visit_type_uint8(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint8(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -2431,8 +2420,7 @@ static void property_set_uint16_ptr(Object *obj, Visitor *v, const char *name, uint16_t value; Error *local_err = NULL; - visit_type_uint16(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint16(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -2454,8 +2442,7 @@ static void property_set_uint32_ptr(Object *obj, Visitor *v, const char *name, uint32_t value; Error *local_err = NULL; - visit_type_uint32(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint32(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -2477,8 +2464,7 @@ static void property_set_uint64_ptr(Object *obj, Visitor *v, const char *name, uint64_t value; Error *local_err = NULL; - visit_type_uint64(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_uint64(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 7e26f86fa6..3085ae0b31 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -63,8 +63,7 @@ Object *user_creatable_add_type(const char *type, const char *id, assert(qdict); obj = object_new(type); - visit_start_struct(v, NULL, NULL, 0, &local_err); - if (local_err) { + if (!visit_start_struct(v, NULL, NULL, 0, &local_err)) { goto out; } for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index a2f4733eed..343c227c09 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -467,8 +467,7 @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, Error *err = NULL; uint32_t max_vq; - visit_type_uint32(v, name, &max_vq, &err); - if (err) { + if (!visit_type_uint32(v, name, &max_vq, &err)) { error_propagate(errp, err); return; } @@ -513,8 +512,7 @@ static void cpu_arm_set_sve_vq(Object *obj, Visitor *v, const char *name, Error *err = NULL; bool value; - visit_type_bool(v, name, &value, &err); - if (err) { + if (!visit_type_bool(v, name, &value, &err)) { error_propagate(errp, err); return; } @@ -550,8 +548,7 @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name, bool value; uint64_t t; - visit_type_bool(v, name, &value, &err); - if (err) { + if (!visit_type_bool(v, name, &value, &err)) { error_propagate(errp, err); return; } diff --git a/target/arm/monitor.c b/target/arm/monitor.c index ea6598c412..98fe11ae69 100644 --- a/target/arm/monitor.c +++ b/target/arm/monitor.c @@ -174,8 +174,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, Error *err = NULL; visitor = qobject_input_visitor_new(model->props); - visit_start_struct(visitor, NULL, NULL, 0, &err); - if (err) { + if (!visit_start_struct(visitor, NULL, NULL, 0, &err)) { visit_free(visitor); object_unref(obj); error_propagate(errp, err); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 36cbd3d027..c69d057df3 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4420,8 +4420,7 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -4463,8 +4462,7 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -4501,8 +4499,7 @@ static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -4606,8 +4603,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, const char *name, Error *local_err = NULL; int64_t value; - visit_type_int(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_int(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } @@ -6816,8 +6812,7 @@ static void x86_cpu_set_bit_prop(Object *obj, Visitor *v, const char *name, return; } - visit_type_bool(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_bool(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/target/ppc/compat.c b/target/ppc/compat.c index fda0dfe8f8..42f87a4bfe 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -264,8 +264,7 @@ static void ppc_compat_prop_set(Object *obj, Visitor *v, const char *name, char *value; uint32_t compat_pvr; - visit_type_str(v, name, &value, &local_err); - if (local_err) { + if (!visit_type_str(v, name, &value, &local_err)) { error_propagate(errp, local_err); return; } diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 2fa609bffe..65c26c4c86 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -510,8 +510,7 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info, if (qdict) { visitor = qobject_input_visitor_new(info->props); - visit_start_struct(visitor, NULL, NULL, 0, &err); - if (err) { + if (!visit_start_struct(visitor, NULL, NULL, 0, &err)) { error_propagate(errp, err); visit_free(visitor); object_unref(obj); @@ -1017,8 +1016,7 @@ static void set_feature(Object *obj, Visitor *v, const char *name, return; } - visit_type_bool(v, name, &value, &err); - if (err) { + if (!visit_type_bool(v, name, &value, &err)) { error_propagate(errp, err); return; } @@ -1076,8 +1074,7 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name, return; } - visit_type_bool(v, name, &value, &err); - if (err) { + if (!visit_type_bool(v, name, &value, &err)) { error_propagate(errp, err); return; } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 3f05aba9d6..4a9257005d 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -804,8 +804,7 @@ static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name, Error *err = NULL; int64_t value; - visit_type_int(v, name, &value, &err); - if (err) { + if (!visit_type_int(v, name, &value, &err)) { error_propagate(errp, err); return; } |