aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/nvdimm.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/mem/nvdimm.c')
-rw-r--r--hw/mem/nvdimm.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 76f66e0b19..d0d6e553cf 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -45,28 +45,24 @@ static void nvdimm_set_label_size(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
NVDIMMDevice *nvdimm = NVDIMM(obj);
- Error *local_err = NULL;
uint64_t value;
if (nvdimm->nvdimm_mr) {
- error_setg(&local_err, "cannot change property value");
- goto out;
+ error_setg(errp, "cannot change property value");
+ return;
}
- visit_type_size(v, name, &value, &local_err);
- if (local_err) {
- goto out;
+ if (!visit_type_size(v, name, &value, errp)) {
+ return;
}
if (value < MIN_NAMESPACE_LABEL_SIZE) {
- error_setg(&local_err, "Property '%s.%s' (0x%" PRIx64 ") is required"
- " at least 0x%lx", object_get_typename(obj),
- name, value, MIN_NAMESPACE_LABEL_SIZE);
- goto out;
+ error_setg(errp, "Property '%s.%s' (0x%" PRIx64 ") is required"
+ " at least 0x%lx", object_get_typename(obj), name, value,
+ MIN_NAMESPACE_LABEL_SIZE);
+ return;
}
nvdimm->label_size = value;
-out:
- error_propagate(errp, local_err);
}
static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name,
@@ -86,22 +82,18 @@ static void nvdimm_set_uuid(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
NVDIMMDevice *nvdimm = NVDIMM(obj);
- Error *local_err = NULL;
char *value;
- visit_type_str(v, name, &value, &local_err);
- if (local_err) {
- goto out;
+ if (!visit_type_str(v, name, &value, errp)) {
+ return;
}
if (qemu_uuid_parse(value, &nvdimm->uuid) != 0) {
error_setg(errp, "Property '%s.%s' has invalid value",
object_get_typename(obj), name);
}
- g_free(value);
-out:
- error_propagate(errp, local_err);
+ g_free(value);
}