{
g_autofree char *type = virXMLPropString(address, "type");
- if (type) {
- if ((info->type = virDomainDeviceAddressTypeFromString(type)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown address type '%s'"), type);
- return -1;
- }
- } else {
+ if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("No type specified for device address"));
return -1;
}
+ if ((info->type = virDomainDeviceAddressTypeFromString(type)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown address type '%s'"), type);
+ return -1;
+ }
+
switch ((virDomainDeviceAddressType) info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
if (virPCIDeviceAddressParseXML(address, &info->addr.pci) < 0)
* <hostdev>. (the functions we're going to call expect address
* type to already be known).
*/
- if (type) {
- if ((def->source.subsys.type
- = virDomainHostdevSubsysTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host device source address type '%s'"),
- type);
- return -1;
- }
- } else {
+ if (!type) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("missing source address type"));
return -1;
}
+ if ((def->source.subsys.type = virDomainHostdevSubsysTypeFromString(type)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host device source address type '%s'"),
+ type);
+ return -1;
+ }
+
if (!(sourcenode = virXPathNode("./source", ctxt))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing <source> element in hostdev device"));
* <hostdev>. (the functions we're going to call expect address
* type to already be known).
*/
- if (type) {
- if ((def->source.caps.type
- = virDomainHostdevCapsTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown host device source address type '%s'"),
- type);
- return -1;
- }
- } else {
+ if (!type) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("missing source address type"));
return -1;
}
+ if ((def->source.caps.type = virDomainHostdevCapsTypeFromString(type)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown host device source address type '%s'"),
+ type);
+ return -1;
+ }
+
if (!virXPathNode("./source", ctxt)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing <source> element in hostdev device"));