summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorMarkus Armbruster2015-09-11 15:04:45 +0200
committerMarkus Armbruster2016-01-13 11:58:58 +0100
commit007b06578ab6063d49b6834d95274c37387a1efb (patch)
treed8218a5a0b7c377079468333483a8d6576ab6192 /hw/core
parenterror: Document how to accumulate multiple errors (diff)
downloadqemu-007b06578ab6063d49b6834d95274c37387a1efb.tar.gz
qemu-007b06578ab6063d49b6834d95274c37387a1efb.tar.xz
qemu-007b06578ab6063d49b6834d95274c37387a1efb.zip
Use error_fatal to simplify obvious fatal errors
Done with this Coccinelle semantic patch: @@ type T; identifier FUN, RET; expression list ARGS; expression ERR, EC; @@ ( - T RET = FUN(ARGS, &ERR); + T RET = FUN(ARGS, &error_fatal); | - RET = FUN(ARGS, &ERR); + RET = FUN(ARGS, &error_fatal); | - FUN(ARGS, &ERR); + FUN(ARGS, &error_fatal); ) - if (ERR != NULL) { - error_report_err(ERR); - exit(EC); - } This is actually a more elegant version of my initial semantic patch by courtesy of Eduardo. It leaves dead Error * variables behind, cleaned up manually. Cc: qemu-arm@nongnu.org Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev-properties-system.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 921e799dbb..d515e99f98 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -367,13 +367,7 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name,
void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name,
BlockBackend *value)
{
- Error *err = NULL;
-
- qdev_prop_set_drive(dev, name, value, &err);
- if (err) {
- error_report_err(err);
- exit(1);
- }
+ qdev_prop_set_drive(dev, name, value, &error_fatal);
}
void qdev_prop_set_chr(DeviceState *dev, const char *name,