@@ -188,6 +188,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
{
ObjectClass *oc;
DeviceClass *dc;
+ const char *original_name = *driver;
oc = object_class_by_name(*driver);
if (!oc) {
@@ -200,7 +201,12 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
}
if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {
- error_setg(errp, "'%s' is not a valid device model name", *driver);
+ if (*driver != original_name) {
+ error_setg(errp, "'%s' (alias '%s') is not a valid device model"
+ " name", original_name, *driver);
+ } else {
+ error_setg(errp, "'%s' is not a valid device model name", *driver);
+ }
return NULL;
}