@@ -336,6 +336,8 @@ struct VMStateDescription {
const VMStateSubsection *subsections;
};
+#define VMSD_NONE ((const VMStateDescription*)1)
+
extern const VMStateInfo vmstate_info_bool;
extern const VMStateInfo vmstate_info_int8;
@@ -283,7 +283,12 @@ int qdev_init(DeviceState *dev)
qdev_free(dev);
return rc;
}
- if (dev->info->vmsd) {
+ if (dev->info->vmsd == NULL) {
+ /* TODO: fixup qemu source code, then make this an assert() */
+ error_report("WARNING: device %s has no vmstate\n", dev->info->name);
+ } else if (dev->info->vmsd == VMSD_NONE) {
+ /* device doesn't need vmstate */;
+ } else {
vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev,
dev->instance_id_alias,
dev->alias_required_for_version);
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- hw/hw.h | 2 ++ hw/qdev.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletions(-)