aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev-properties.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-12-16 14:22:11 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-18 11:26:30 -0600
commit9ef5c4bf8132eb72db2dd83fce3fa0005a6dd13f (patch)
tree441add29c9c683f8637875f1dcbd40fae5d278c9 /hw/qdev-properties.c
parent69fd02eea61e6d9e7cd7831ef26522a5ac9e146c (diff)
qdev: improve property error reporting.
Add a error message in case we fail to parse a qdev property. Also make qemu not abort() in case setting a global property can't be set. This used to be a clear programming error. The introduction of the -global switch changed that though, so better exit instead (after printing the new error message). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r--hw/qdev-properties.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index fb07279ba1..217ddc0b74 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -500,7 +500,12 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
dev->info->name, name);
return -1;
}
- return prop->info->parse(dev, prop, value);
+ if (prop->info->parse(dev, prop, value) != 0) {
+ fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
+ dev->info->name, name, value);
+ return -1;
+ }
+ return 0;
}
void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type)
@@ -619,7 +624,7 @@ void qdev_prop_set_globals(DeviceState *dev)
continue;
}
if (qdev_prop_parse(dev, prop->property, prop->value) != 0) {
- abort();
+ exit(1);
}
}
}