aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
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;
}