diff options
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r-- | hw/qdev-properties.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index b6d6fcff01..7b74dd5beb 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -613,7 +613,7 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop, } if (!*str) { g_free(str); - error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str); + *ptr = NULL; return; } ret = parse(dev, str, ptr); @@ -1072,55 +1072,56 @@ void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value) { Error *errp = NULL; object_property_set_bool(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_string(DeviceState *dev, const char *name, char *value) { Error *errp = NULL; object_property_set_str(OBJECT(dev), value, name, &errp); - assert(!errp); + assert_no_error(errp); } int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value) { Error *errp = NULL; - object_property_set_str(OBJECT(dev), bdrv_get_device_name(value), + const char *bdrv_name = value ? bdrv_get_device_name(value) : ""; + object_property_set_str(OBJECT(dev), bdrv_name, name, &errp); if (errp) { qerror_report_err(errp); @@ -1139,24 +1140,26 @@ void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, BlockDriverS void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value) { Error *errp = NULL; - assert(value->label); - object_property_set_str(OBJECT(dev), value->label, name, &errp); - assert(!errp); + assert(!value || value->label); + object_property_set_str(OBJECT(dev), + value ? value->label : "", name, &errp); + assert_no_error(errp); } void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *value) { Error *errp = NULL; - assert(value->name); - object_property_set_str(OBJECT(dev), value->name, name, &errp); - assert(!errp); + assert(!value || value->name); + object_property_set_str(OBJECT(dev), + value ? value->name : "", name, &errp); + assert_no_error(errp); } void qdev_prop_set_vlan(DeviceState *dev, const char *name, VLANState *value) { Error *errp = NULL; object_property_set_int(OBJECT(dev), value ? value->id : -1, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value) @@ -1167,7 +1170,7 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value) value[0], value[1], value[2], value[3], value[4], value[5]); object_property_set_str(OBJECT(dev), str, name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) @@ -1178,7 +1181,7 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) prop = qdev_prop_find(dev, name); object_property_set_str(OBJECT(dev), prop->info->enum_table[value], name, &errp); - assert(!errp); + assert_no_error(errp); } void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value) @@ -1210,7 +1213,7 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props) } else if (props->qtype == QTYPE_QINT) { object_property_set_int(obj, props->defval, props->name, &errp); } - assert(!errp); + assert_no_error(errp); } } |