diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-11-13 09:26:25 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-12-10 17:16:44 +0100 |
commit | 74b97760dcb20aa03189dc63f0ff79eb3516b5ee (patch) | |
tree | bf80684cee84913415ec7e9c34778b8a0309d470 | |
parent | 9fc0ab5c9ca6bd3d3179a85a5cff18d709550bf5 (diff) |
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>
-rw-r--r-- | qom/qom-qmp-cmds.c | 17 |
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; } |