@@ -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;
}
@@ -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;
}
@@ -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) {
@@ -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;
@@ -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) {
@@ -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) {
@@ -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;
}
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -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);
@@ -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 */
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -124,8 +124,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;
}
@@ -188,8 +187,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;
}
@@ -485,8 +483,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;
}
@@ -539,8 +536,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;
}
@@ -673,8 +669,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);
@@ -755,8 +750,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;
}
@@ -805,8 +799,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;
}
@@ -887,8 +880,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;
}
@@ -987,8 +979,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;
}
@@ -1069,8 +1060,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;
}
@@ -1401,8 +1391,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;
}
@@ -1489,8 +1479,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;
}
@@ -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;
}
@@ -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;
}
@@ -1854,8 +1854,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;
}
@@ -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 */
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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 */
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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 */
@@ -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;
}
@@ -233,22 +233,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;
}
}
@@ -281,8 +277,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;
}
@@ -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;
}
@@ -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) {
@@ -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) {
@@ -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) {
@@ -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) {
@@ -2080,8 +2080,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;
}
@@ -2161,8 +2160,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;
}
@@ -2234,8 +2232,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;
}
@@ -2305,32 +2302,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);
@@ -2394,8 +2384,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;
}
@@ -2417,8 +2406,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;
}
@@ -2440,8 +2428,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;
}
@@ -2463,8 +2450,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;
}
@@ -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)) {
@@ -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;
}
@@ -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);
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
The previous commit enables conversion of visit_foo(..., &err); if (err) { ... } to if (!visit_foo(..., errp)) { ... } for visitor functions that now return true / false on success / error. Coccinelle script: @@ identifier fun =~ "check_list|input_type_enum|lv_start_struct|lv_type_bool|lv_type_int64|lv_type_str|lv_type_uint64|output_type_enum|parse_type_bool|parse_type_int64|parse_type_null|parse_type_number|parse_type_size|parse_type_str|parse_type_uint64|print_type_bool|print_type_int64|print_type_null|print_type_number|print_type_size|print_type_str|print_type_uint64|qapi_clone_start_alternate|qapi_clone_start_list|qapi_clone_start_struct|qapi_clone_type_bool|qapi_clone_type_int64|qapi_clone_type_null|qapi_clone_type_number|qapi_clone_type_str|qapi_clone_type_uint64|qapi_dealloc_start_list|qapi_dealloc_start_struct|qapi_dealloc_type_anything|qapi_dealloc_type_bool|qapi_dealloc_type_int64|qapi_dealloc_type_null|qapi_dealloc_type_number|qapi_dealloc_type_str|qapi_dealloc_type_uint64|qobject_input_check_list|qobject_input_check_struct|qobject_input_start_alternate|qobject_input_start_list|qobject_input_start_struct|qobject_input_type_any|qobject_input_type_bool|qobject_input_type_bool_keyval|qobject_input_type_int64|qobject_input_type_int64_keyval|qobject_input_type_null|qobject_input_type_number|qobject_input_type_number_keyval|qobject_input_type_size_keyval|qobject_input_type_str|qobject_input_type_str_keyval|qobject_input_type_uint64|qobject_input_type_uint64_keyval|qobject_output_start_list|qobject_output_start_struct|qobject_output_type_any|qobject_output_type_bool|qobject_output_type_int64|qobject_output_type_null|qobject_output_type_number|qobject_output_type_str|qobject_output_type_uint64|start_list|visit_check_list|visit_check_struct|visit_start_alternate|visit_start_list|visit_start_struct|visit_type_.*"; expression list args; typedef Error; Error *err; @@ - fun(args, &err); - if (err) + if (!fun(args, &err)) { ... } A few line breaks tidied up manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- accel/kvm/kvm-all.c | 3 +-- accel/tcg/tcg-all.c | 3 +-- backends/cryptodev.c | 3 +-- backends/hostmem-file.c | 3 +-- backends/hostmem-memfd.c | 3 +-- backends/hostmem.c | 6 ++--- backends/tpm/tpm_util.c | 3 +-- block/blkdebug.c | 3 +-- block/nbd.c | 3 +-- block/sheepdog.c | 3 +-- block/throttle-groups.c | 6 ++--- bootdevice.c | 3 +-- hw/block/xen-block.c | 3 +-- hw/core/machine.c | 3 +-- hw/core/qdev-properties-system.c | 12 +++------ hw/core/qdev-properties.c | 38 +++++++++++------------------ hw/cpu/core.c | 6 ++--- hw/gpio/aspeed_gpio.c | 3 +-- hw/i386/pc.c | 3 +-- hw/ide/qdev.c | 3 +-- hw/intc/apic_common.c | 3 +-- hw/mem/nvdimm.c | 6 ++--- hw/misc/aspeed_sdmc.c | 3 +-- hw/misc/pca9552.c | 3 +-- hw/misc/tmp105.c | 3 +-- hw/misc/tmp421.c | 3 +-- hw/net/ne2000-isa.c | 3 +-- hw/ppc/spapr_caps.c | 9 +++---- hw/ppc/spapr_drc.c | 10 +++----- hw/s390x/css.c | 3 +-- hw/usb/dev-storage.c | 3 +-- hw/vfio/pci-quirks.c | 3 +-- hw/virtio/virtio-balloon.c | 15 ++++-------- iothread.c | 3 +-- monitor/hmp-cmds.c | 3 +-- net/colo-compare.c | 6 ++--- net/dump.c | 3 +-- net/filter-buffer.c | 3 +-- qom/object.c | 42 +++++++++++--------------------- qom/object_interfaces.c | 3 +-- target/arm/cpu64.c | 9 +++---- target/arm/monitor.c | 3 +-- target/i386/cpu.c | 15 ++++-------- target/ppc/compat.c | 3 +-- target/s390x/cpu_models.c | 9 +++---- target/sparc/cpu.c | 3 +-- 46 files changed, 97 insertions(+), 188 deletions(-)