summaryrefslogtreecommitdiffstats
path: root/qom
diff options
context:
space:
mode:
authorMarkus Armbruster2020-11-13 09:26:25 +0100
committerMarkus Armbruster2020-12-10 17:16:44 +0100
commit74b97760dcb20aa03189dc63f0ff79eb3516b5ee (patch)
treebf80684cee84913415ec7e9c34778b8a0309d470 /qom
parentqga: Tweak a guest-shutdown error message (diff)
downloadqemu-74b97760dcb20aa03189dc63f0ff79eb3516b5ee.tar.gz
qemu-74b97760dcb20aa03189dc63f0ff79eb3516b5ee.tar.xz
qemu-74b97760dcb20aa03189dc63f0ff79eb3516b5ee.zip
qom: Improve {qom,device}-list-properties error messages
device-list-properties reports Parameter 'typename' expects device when @typename exists, but isn't a TYPE_DEVICE. Improve this to Parameter 'typename' expects a non-abstract device type qom-list-properties reports Parameter 'typename' expects object when @typename exists, but isn't a TYPE_OBJECT. Improve this to Parameter 'typename' expects a QOM type Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201113082626.2725812-10-armbru@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/qom-qmp-cmds.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
index 310ab2d048..2dd233f293 100644
--- a/qom/qom-qmp-cmds.c
+++ b/qom/qom-qmp-cmds.c
@@ -138,15 +138,10 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
return NULL;
}
- klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
- if (klass == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
- return NULL;
- }
-
- if (object_class_is_abstract(klass)) {
+ if (!object_class_dynamic_cast(klass, TYPE_DEVICE)
+ || object_class_is_abstract(klass)) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
- "non-abstract device type");
+ "a non-abstract device type");
return NULL;
}
@@ -208,9 +203,9 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
return NULL;
}
- klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
- if (klass == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
+ if (!object_class_dynamic_cast(klass, TYPE_OBJECT)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
+ "a QOM type");
return NULL;
}