qdev: convert setting device properties to QError
This commit is contained in:
parent
84745d68e7
commit
fdcfa190ab
|
@ -548,24 +548,23 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
|
|||
* removed along with it.
|
||||
*/
|
||||
if (!prop || !prop->info->parse) {
|
||||
fprintf(stderr, "property \"%s.%s\" not found\n",
|
||||
dev->info->name, name);
|
||||
qerror_report(QERR_PROPERTY_NOT_FOUND, dev->info->name, name);
|
||||
return -1;
|
||||
}
|
||||
ret = prop->info->parse(dev, prop, value);
|
||||
if (ret < 0) {
|
||||
switch (ret) {
|
||||
case -EEXIST:
|
||||
fprintf(stderr, "property \"%s.%s\": \"%s\" is already in use\n",
|
||||
qerror_report(QERR_PROPERTY_VALUE_IN_USE,
|
||||
dev->info->name, name, value);
|
||||
break;
|
||||
default:
|
||||
case -EINVAL:
|
||||
fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
|
||||
qerror_report(QERR_PROPERTY_VALUE_BAD,
|
||||
dev->info->name, name, value);
|
||||
break;
|
||||
case -ENOENT:
|
||||
fprintf(stderr, "property \"%s.%s\": could not find \"%s\"\n",
|
||||
qerror_report(QERR_PROPERTY_VALUE_NOT_FOUND,
|
||||
dev->info->name, name, value);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue