Convert the field, and fill in missing cases to switch()
statements.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/conf/domain_audit.c          |  2 +-
 src/conf/domain_conf.c           | 57 +++++++++++++++++++-------------
 src/conf/domain_conf.h           |  2 +-
 src/conf/domain_validate.c       |  2 +-
 src/libxl/libxl_driver.c         | 12 +++++++
 src/lxc/lxc_controller.c         |  5 +++
 src/lxc/lxc_driver.c             | 10 ++++++
 src/lxc/lxc_hostdev.c            |  5 +++
 src/qemu/qemu_command.c          |  2 +-
 src/qemu/qemu_domain.c           |  4 +--
 src/qemu/qemu_hotplug.c          |  4 ++-
 src/qemu/qemu_migration.c        |  2 +-
 src/qemu/qemu_validate.c         |  2 +-
 src/security/security_apparmor.c |  2 +-
 src/security/security_dac.c      |  4 +--
 src/security/security_selinux.c  |  4 +--
 src/security/virt-aa-helper.c    |  3 ++
 17 files changed, 85 insertions(+), 37 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 0bf1768acd..4294b50c3a 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -353,7 +353,7 @@ virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef 
*hostdev,
 
     switch (hostdev->mode) {
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
-        switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
+        switch (hostdev->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
             address = virPCIDeviceAddressAsString(&pcisrc->addr);
             break;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cf1bd4df74..35cb14b986 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2632,7 +2632,7 @@ virDomainHostdevDefClear(virDomainHostdevDef *def)
         }
         break;
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
-        switch ((virDomainHostdevSubsysType) def->source.subsys.type) {
+        switch (def->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
             virDomainHostdevSubsysSCSIClear(&def->source.subsys.u.scsi);
             break;
@@ -6168,7 +6168,7 @@ 
virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDef *def,
 static int
 virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
                                   xmlXPathContextPtr ctxt,
-                                  const char *type,
+                                  virDomainHostdevSubsysType type,
                                   virDomainHostdevDef *def,
                                   unsigned int flags,
                                   virDomainXMLOption *xmlopt)
@@ -6202,18 +6202,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
      * <hostdev>.  (the functions we're going to call expect address
      * type to already be known).
      */
-    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 '%1$s'"),
-                       type);
-        return -1;
-    }
+    def->source.subsys.type = type;
 
     if (!(sourcenode = virXPathNode("./source", ctxt))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -6322,6 +6311,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
             return -1;
         break;
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("address type='%1$s' not supported in hostdev 
interfaces"),
@@ -8868,6 +8858,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
         }
     } else if (actual->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
         virDomainHostdevDef *hostdev = &actual->data.hostdev.def;
+        int type;
 
         hostdev->parentnet = parent;
         hostdev->info = &parent->info;
@@ -8879,8 +8870,16 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
         /* if not explicitly stated, source/vendor implies usb device */
         if (!addrtype && virXPathNode("./source/vendor", ctxt))
             addrtype = g_strdup("usb");
+
+        if ((type = virDomainHostdevSubsysTypeFromString(addrtype)) < 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("unknown host device source address type '%1$s'"),
+                           addrtype);
+            goto error;
+        }
+
         hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
-        if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
+        if (virDomainHostdevDefParseXMLSubsys(node, ctxt, type,
                                               hostdev, flags, xmlopt) < 0) {
             goto error;
         }
@@ -9544,6 +9543,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
 
     case VIR_DOMAIN_NET_TYPE_HOSTDEV: {
         g_autofree char *addrtype = 
virXPathString("string(./source/address/@type)", ctxt);
+        int type;
 
         def->data.hostdev.def.parentnet = def;
         def->data.hostdev.def.info = &def->info;
@@ -9556,7 +9556,15 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
         /* The helper function expects type to already be found and
          * passed in as a string, since it is in a different place in
          * NetDef vs HostdevDef. */
-        if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
+
+        if ((type = virDomainHostdevSubsysTypeFromString(addrtype)) < 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("unknown host device source address type '%1$s'"),
+                           addrtype);
+            return NULL;
+        }
+
+        if (virDomainHostdevDefParseXMLSubsys(node, ctxt, type,
                                               &def->data.hostdev.def,
                                               flags, xmlopt) < 0)
             return NULL;
@@ -12909,8 +12917,7 @@ virDomainHostdevDefParseXML(virDomainXMLOption *xmlopt,
 {
     virDomainHostdevDef *def;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
-    g_autofree char *type = virXMLPropString(node, "type");
-    unsigned int typeU;
+    unsigned int type;
 
     ctxt->node = node;
 
@@ -12926,6 +12933,10 @@ virDomainHostdevDefParseXML(virDomainXMLOption *xmlopt,
     switch (def->mode) {
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
         /* parse managed/mode/type, and the <source> element */
+        if (virXMLPropEnum(node, "type",
+                           virDomainHostdevSubsysTypeFromString,
+                           VIR_XML_PROP_REQUIRED, &type) < 0)
+            goto error;
         if (virDomainHostdevDefParseXMLSubsys(node, ctxt, type, def, flags, 
xmlopt) < 0)
             goto error;
         break;
@@ -12933,10 +12944,10 @@ virDomainHostdevDefParseXML(virDomainXMLOption 
*xmlopt,
         /* parse managed/mode/type, and the <source> element */
         if (virXMLPropEnum(node, "type",
                            virDomainHostdevCapsTypeFromString,
-                           VIR_XML_PROP_REQUIRED, &typeU) < 0)
+                           VIR_XML_PROP_REQUIRED, &type) < 0)
             goto error;
 
-        if (virDomainHostdevDefParseXMLCaps(node, ctxt, typeU, def) < 0)
+        if (virDomainHostdevDefParseXMLCaps(node, ctxt, type, def) < 0)
             goto error;
         break;
     default:
@@ -12953,7 +12964,7 @@ virDomainHostdevDefParseXML(virDomainXMLOption *xmlopt,
             goto error;
     }
     if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        switch ((virDomainHostdevSubsysType) def->source.subsys.type) {
+        switch (def->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
             if (virXPathBoolean("boolean(./readonly)", ctxt))
                 def->readonly = true;
@@ -14087,7 +14098,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDef *a,
     if (a->source.subsys.type != b->source.subsys.type)
         return 0;
 
-    switch ((virDomainHostdevSubsysType) a->source.subsys.type) {
+    switch (a->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
         return virDomainHostdevMatchSubsysPCI(a, b);
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
@@ -23436,7 +23447,7 @@ virDomainHostdevDefFormatSubsys(virBuffer *buf,
                                 bool includeTypeInAddr,
                                 virDomainXMLOption *xmlopt)
 {
-    switch ((virDomainHostdevSubsysType) def->source.subsys.type) {
+    switch (def->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
         virDomainHostdevDefFormatSubsysUSB(buf, def, flags, includeTypeInAddr);
         return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0e76ff71ac..fc612f3adb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -316,7 +316,7 @@ struct _virDomainHostdevSubsysSCSIVHost {
 };
 
 struct _virDomainHostdevSubsys {
-    int type; /* enum virDomainHostdevSubsysType */
+    virDomainHostdevSubsysType type;
     union {
         virDomainHostdevSubsysUSB usb;
         virDomainHostdevSubsysPCI pci;
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index a8f90af3aa..1d25aa32c2 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2149,7 +2149,7 @@ static int
 virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
 {
     if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
+        switch (hostdev->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
             if (hostdev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
                 hostdev->info->type != 
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED &&
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c8ca903050..c98d2d737a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3271,6 +3271,10 @@ libxlDomainAttachHostDevice(libxlDriverPrivate *driver,
             return -1;
         break;
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("hostdev subsys type '%1$s' not supported"),
@@ -3561,6 +3565,10 @@ libxlDomainAttachDeviceConfig(virDomainDef *vmdef, 
virDomainDeviceDef *dev)
             case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
             case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
                 return -1;
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+                break;
             }
 
             if (virDomainHostdevFind(vmdef, hostdev, &found) >= 0) {
@@ -3835,6 +3843,10 @@ libxlDomainDetachHostDevice(libxlDriverPrivate *driver,
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
             return libxlDomainDetachHostUSBDevice(driver, vm, hostdev);
 
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
         default:
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("unexpected hostdev type %1$d"), subsys->type);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 7e486d0f78..48f5c73fce 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1776,6 +1776,11 @@ virLXCControllerSetupHostdevSubsys(virDomainDef *vmDef,
                                                      def,
                                                      securityDriver);
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported host device mode %1$s"),
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a9bdeba36d..25cbfc57c9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3848,6 +3848,11 @@ lxcDomainAttachDeviceHostdevSubsysLive(virLXCDriver 
*driver,
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
         return lxcDomainAttachDeviceHostdevSubsysUSBLive(driver, vm, dev);
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported host device type %1$s"),
@@ -4281,6 +4286,11 @@ lxcDomainDetachDeviceHostdevSubsysLive(virLXCDriver 
*driver,
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
         return lxcDomainDetachDeviceHostdevUSBLive(driver, vm, dev);
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported host device type %1$s"),
diff --git a/src/lxc/lxc_hostdev.c b/src/lxc/lxc_hostdev.c
index 2e06b516d4..0c4f0b8cac 100644
--- a/src/lxc/lxc_hostdev.c
+++ b/src/lxc/lxc_hostdev.c
@@ -76,6 +76,11 @@ int virLXCPrepareHostDevices(virLXCDriver *driver,
             switch (dev->source.subsys.type) {
             case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
                 break;
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
             default:
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("Unsupported hostdev type %1$s"),
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ccbf41a0f7..701efd46b4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5141,7 +5141,7 @@ qemuBuildHostdevCommandLine(virCommand *cmd,
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
             continue;
 
-        switch ((virDomainHostdevSubsysType) subsys->type) {
+        switch (subsys->type) {
         /* USB */
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
             if (!(devprops = qemuBuildUSBHostdevDevProps(def, hostdev, 
qemuCaps)))
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 818e3822d0..47c3d69bda 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10680,7 +10680,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
 
     switch (dev->mode) {
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
-        switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+        switch (dev->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
             if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
                 if (!(tmpPath = 
virPCIDeviceAddressGetIOMMUGroupDev(&pcisrc->addr)))
@@ -11488,7 +11488,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev,
     if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
         return 0;
 
-    switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) {
+    switch (hostdev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
         return qemuDomainPrepareHostdevSCSI(hostdev, priv);
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d4f01cfd93..21154892ae 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2791,6 +2791,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver,
             return -1;
         break;
 
+    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
     default:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("hotplug is not supported for hostdev subsys type 
'%1$s'"),
@@ -4680,7 +4681,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver,
     if (qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
         VIR_WARN("Unable to remove host device from /dev");
 
-    switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) {
+    switch (hostdev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
         qemuDomainRemovePCIHostDevice(driver, vm, hostdev);
         /* QEMU might no longer need to lock as much memory, eg. we just
@@ -5726,6 +5727,7 @@ qemuDomainDetachPrepHostdev(virDomainObj *vm,
             break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
             break;
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
         default:
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("unexpected hostdev type %1$d"), subsys->type);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 9ed5c6e94b..011482c2b5 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1287,7 +1287,7 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
             return false;
 
         case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
-            switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) {
+            switch (hostdev->source.subsys.type) {
             case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
                 /* USB devices can be "migrated" */
                 continue;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 18d34e7f59..315fc676f2 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2448,7 +2448,7 @@ qemuValidateDomainDeviceDefHostdev(const 
virDomainHostdevDef *hostdev,
     }
 
     if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
+        switch (hostdev->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
             if (hostdev->source.subsys.u.usb.guestReset &&
                 !virQEMUCapsGet(qemuCaps, 
QEMU_CAPS_USB_HOST_GUESTS_RESETS_ALL)) {
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 27d64a23bb..bce797de7c 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -846,7 +846,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManager *mgr,
     ptr->mgr = mgr;
     ptr->def = def;
 
-    switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+    switch (dev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
         virUSBDevice *usb =
             virUSBDeviceNew(usbsrc->bus, usbsrc->device, vroot);
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 4667328b26..c07e488db7 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1230,7 +1230,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr,
     if (cbdata.secdef && !cbdata.secdef->relabel)
         return 0;
 
-    switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+    switch (dev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
         g_autoptr(virUSBDevice) usb = NULL;
 
@@ -1393,7 +1393,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr,
         scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
         return 0;
 
-    switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+    switch (dev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
         g_autoptr(virUSBDevice) usb = NULL;
 
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 1fa5303495..07d779a947 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -2184,7 +2184,7 @@ 
virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr,
         scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
         return 0;
 
-    switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+    switch (dev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
         g_autoptr(virUSBDevice) usb = NULL;
 
@@ -2420,7 +2420,7 @@ 
virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager *mgr,
         scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
         return 0;
 
-    switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
+    switch (dev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
         g_autoptr(virUSBDevice) usb = NULL;
 
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 4638451183..0855eb68ca 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1106,6 +1106,9 @@ get_files(vahControl * ctl)
                 break;
             }
 
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+            case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
             default:
                 rc = 0;
                 break;
-- 
2.41.0

Reply via email to