summaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-12-19 11:39:20 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-12-19 11:39:21 +0000
commit31b2bd89b915d527ff907e8f3c151585e0c45d4f (patch)
tree10d10d83ee630517834071dfca74ffc02b351eeb /hw/core
parentaceeaa69d28e6f08a24395d0aa6915b687d0a681 (diff)
parentd936613547aec49b0b80193cee0b9df05cd8a2ae (diff)
downloadqemu-31b2bd89b915d527ff907e8f3c151585e0c45d4f.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2019-12-17-v2' into staging
Error reporting patches for 2019-12-17 # gpg: Signature made Wed 18 Dec 2019 07:45:24 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-error-2019-12-17-v2: (35 commits) nbd: assert that Error** is not NULL in nbd_iter_channel_error hw/vfio/ap: drop local_err from vfio_ap_realize backends/cryptodev: drop local_err from cryptodev_backend_complete() include/qom/object.h: rename Error ** parameter to more common errp hw/usb: rename Error ** parameter to more common errp hw/tpm: rename Error ** parameter to more common errp hw/sd: drop extra whitespace in sdhci_sysbus_realize() header hw/s390x: rename Error ** parameter to more common errp monitor/qmp-cmds: rename Error ** parameter to more common errp qga: rename Error ** parameter to more common errp hw/i386/amd_iommu: rename Error ** parameter to more common errp block/snapshot: rename Error ** parameter to more common errp hw/core/qdev: cleanup Error ** variables 9pfs: make Error **errp const where it is appropriate ppc: make Error **errp const where it is appropriate Revert "ppc: well form kvmppc_hint_smt_possible error hint helper" qdev-monitor: make Error **errp const where it is appropriate vnc: drop Error pointer indirection in vnc_client_io_error hmp: drop Error pointer indirection in hmp_handle_error error: make Error **errp const where it is appropriate ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/loader-fit.c15
-rw-r--r--hw/core/machine-hmp-cmds.c6
-rw-r--r--hw/core/qdev.c28
3 files changed, 24 insertions, 25 deletions
diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
index 953b16bc82..c465921b8f 100644
--- a/hw/core/loader-fit.c
+++ b/hw/core/loader-fit.c
@@ -178,11 +178,12 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
int cfg, void *opaque, const void *match_data,
hwaddr kernel_end, Error **errp)
{
+ Error *err = NULL;
const char *name;
const void *data;
const void *load_data;
hwaddr load_addr;
- int img_off, err;
+ int img_off;
size_t sz;
int ret;
@@ -197,13 +198,13 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
return -EINVAL;
}
- err = fit_image_addr(itb, img_off, "load", &load_addr, errp);
- if (err == -ENOENT) {
+ ret = fit_image_addr(itb, img_off, "load", &load_addr, &err);
+ if (ret == -ENOENT) {
load_addr = ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB);
- error_free(*errp);
- } else if (err) {
- error_prepend(errp, "unable to read FDT load address from FIT: ");
- ret = err;
+ error_free(err);
+ } else if (ret) {
+ error_propagate_prepend(errp, err,
+ "unable to read FDT load address from FIT: ");
goto out;
}
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
index cd970cc4c5..b76f7223af 100644
--- a/hw/core/machine-hmp-cmds.c
+++ b/hw/core/machine-hmp-cmds.c
@@ -55,7 +55,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict)
cpuid = qdict_get_int(qdict, "id");
qmp_cpu_add(cpuid, &err);
- hmp_handle_error(mon, &err);
+ hmp_handle_error(mon, err);
}
void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
@@ -66,7 +66,7 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
CpuInstanceProperties *c;
if (err != NULL) {
- hmp_handle_error(mon, &err);
+ hmp_handle_error(mon, err);
return;
}
@@ -135,7 +135,7 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "\n");
qapi_free_MemdevList(memdev_list);
- hmp_handle_error(mon, &err);
+ hmp_handle_error(mon, err);
}
void hmp_info_numa(Monitor *mon, const QDict *qdict)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index cf1ba28fe3..82d3ee590a 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -820,12 +820,12 @@ static bool device_get_realized(Object *obj, Error **errp)
return dev->realized;
}
-static bool check_only_migratable(Object *obj, Error **err)
+static bool check_only_migratable(Object *obj, Error **errp)
{
DeviceClass *dc = DEVICE_GET_CLASS(obj);
if (!vmstate_check_only_migratable(dc->vmsd)) {
- error_setg(err, "Device %s is not migratable, but "
+ error_setg(errp, "Device %s is not migratable, but "
"--only-migratable was specified",
object_get_typename(obj));
return false;
@@ -874,10 +874,9 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
if (dc->realize) {
dc->realize(dev, &local_err);
- }
-
- if (local_err != NULL) {
- goto fail;
+ if (local_err != NULL) {
+ goto fail;
+ }
}
DEVICE_LISTENER_CALL(realize, Forward, dev);
@@ -918,27 +917,26 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
}
} else if (!value && dev->realized) {
- Error **local_errp = NULL;
+ /* We want local_err to track only the first error */
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
- local_errp = local_err ? NULL : &local_err;
object_property_set_bool(OBJECT(bus), false, "realized",
- local_errp);
+ local_err ? NULL : &local_err);
}
if (qdev_get_vmsd(dev)) {
vmstate_unregister(dev, qdev_get_vmsd(dev), dev);
}
if (dc->unrealize) {
- local_errp = local_err ? NULL : &local_err;
- dc->unrealize(dev, local_errp);
+ dc->unrealize(dev, local_err ? NULL : &local_err);
}
dev->pending_deleted_event = true;
DEVICE_LISTENER_CALL(unrealize, Reverse, dev);
- }
- if (local_err != NULL) {
- goto fail;
+ if (local_err != NULL) {
+ goto fail;
+ }
}
+ assert(local_err == NULL);
dev->realized = value;
return;
@@ -976,7 +974,7 @@ static bool device_get_hotpluggable(Object *obj, Error **errp)
qbus_is_hotpluggable(dev->parent_bus));
}
-static bool device_get_hotplugged(Object *obj, Error **err)
+static bool device_get_hotplugged(Object *obj, Error **errp)
{
DeviceState *dev = DEVICE(obj);