aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/cryptodev.c11
-rw-r--r--backends/hostmem-file.c19
-rw-r--r--backends/hostmem-memfd.c15
-rw-r--r--backends/hostmem.c27
4 files changed, 30 insertions, 42 deletions
diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index 72b7077..4de3785 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -158,16 +158,15 @@ cryptodev_backend_set_queues(Object *obj, Visitor *v, const char *name,
uint32_t value;
if (!visit_type_uint32(v, name, &value, &local_err)) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
if (!value) {
- error_setg(&local_err, "Property '%s.%s' doesn't take value '%"
- PRIu32 "'", object_get_typename(obj), name, value);
- goto out;
+ error_setg(errp, "Property '%s.%s' doesn't take value '%" PRIu32 "'",
+ object_get_typename(obj), name, value);
+ return;
}
backend->conf.peers.queues = value;
-out:
- error_propagate(errp, local_err);
}
static void
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index 320dffb..a44f5a6 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -114,18 +114,16 @@ static void file_memory_backend_set_align(Object *o, Visitor *v,
uint64_t val;
if (host_memory_backend_mr_inited(backend)) {
- error_setg(&local_err, "cannot change property '%s' of %s",
- name, object_get_typename(o));
- goto out;
+ error_setg(errp, "cannot change property '%s' of %s", name,
+ object_get_typename(o));
+ return;
}
if (!visit_type_size(v, name, &val, &local_err)) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
fb->align = val;
-
- out:
- error_propagate(errp, local_err);
}
static bool file_memory_backend_get_pmem(Object *o, Error **errp)
@@ -139,7 +137,6 @@ static void file_memory_backend_set_pmem(Object *o, bool value, Error **errp)
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
if (host_memory_backend_mr_inited(backend)) {
-
error_setg(errp, "cannot change property 'pmem' of %s.",
object_get_typename(o));
return;
@@ -147,13 +144,9 @@ static void file_memory_backend_set_pmem(Object *o, bool value, Error **errp)
#ifndef CONFIG_LIBPMEM
if (value) {
- Error *local_err = NULL;
-
- error_setg(&local_err,
- "Lack of libpmem support while setting the 'pmem=on'"
+ error_setg(errp, "Lack of libpmem support while setting the 'pmem=on'"
" of %s. We can't ensure data persistence.",
object_get_typename(o));
- error_propagate(errp, local_err);
return;
}
#endif
diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
index d4281c0..1e74a2b 100644
--- a/backends/hostmem-memfd.c
+++ b/backends/hostmem-memfd.c
@@ -81,21 +81,20 @@ memfd_backend_set_hugetlbsize(Object *obj, Visitor *v, const char *name,
uint64_t value;
if (host_memory_backend_mr_inited(MEMORY_BACKEND(obj))) {
- error_setg(&local_err, "cannot change property value");
- goto out;
+ error_setg(errp, "cannot change property value");
+ return;
}
if (!visit_type_size(v, name, &value, &local_err)) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
if (!value) {
- error_setg(&local_err, "Property '%s.%s' doesn't take value '%"
- PRIu64 "'", object_get_typename(obj), name, value);
- goto out;
+ error_setg(errp, "Property '%s.%s' doesn't take value '%" PRIu64 "'",
+ object_get_typename(obj), name, value);
+ return;
}
m->hugetlbsize = value;
-out:
- error_propagate(errp, local_err);
}
static void
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 4e4103a..5cc264b 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -58,23 +58,22 @@ host_memory_backend_set_size(Object *obj, Visitor *v, const char *name,
uint64_t value;
if (host_memory_backend_mr_inited(backend)) {
- error_setg(&local_err, "cannot change property %s of %s ",
- name, object_get_typename(obj));
- goto out;
+ error_setg(errp, "cannot change property %s of %s ", name,
+ object_get_typename(obj));
+ return;
}
if (!visit_type_size(v, name, &value, &local_err)) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
if (!value) {
- error_setg(&local_err,
+ error_setg(errp,
"property '%s' of %s doesn't take value '%" PRIu64 "'",
name, object_get_typename(obj), value);
- goto out;
+ return;
}
backend->size = value;
-out:
- error_propagate(errp, local_err);
}
static void
@@ -257,17 +256,15 @@ static void host_memory_backend_set_prealloc_threads(Object *obj, Visitor *v,
uint32_t value;
if (!visit_type_uint32(v, name, &value, &local_err)) {
- goto out;
+ error_propagate(errp, local_err);
+ return;
}
if (value <= 0) {
- error_setg(&local_err,
- "property '%s' of %s doesn't take value '%d'",
- name, object_get_typename(obj), value);
- goto out;
+ error_setg(errp, "property '%s' of %s doesn't take value '%d'", name,
+ object_get_typename(obj), value);
+ return;
}
backend->prealloc_threads = value;
-out:
- error_propagate(errp, local_err);
}
static void host_memory_backend_init(Object *obj)