Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 src/conf/domain_conf.c         | 4 +++-
 src/conf/domain_conf.h         | 2 +-
 src/qemu/qemu_command.c        | 2 +-
 src/qemu/qemu_domain_address.c | 2 +-
 src/qemu/qemu_validate.c       | 2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f599d1afe7..50ddb293ed 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13174,17 +13174,19 @@ virDomainSoundDefParseXML(virDomainXMLOption *xmlopt,
     virDomainSoundDef *def;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
     g_autofree char *model = NULL;
+    int modelval;
     xmlNodePtr audioNode;
 
     def = g_new0(virDomainSoundDef, 1);
     ctxt->node = node;
 
     model = virXMLPropString(node, "model");
-    if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) {
+    if ((modelval = virDomainSoundModelTypeFromString(model)) < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("unknown sound model '%s'"), model);
         goto error;
     }
+    def->model = modelval;
 
     if (virDomainSoundModelSupportsCodecs(def)) {
         int ncodecs;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4838687edf..ede80ac322 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1449,7 +1449,7 @@ struct _virDomainSoundCodecDef {
 };
 
 struct _virDomainSoundDef {
-    int model;
+    virDomainSoundModel model;
     virDomainDeviceInfo info;
 
     size_t ncodecs;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index be93182092..d7f1c715b6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4133,7 +4133,7 @@ qemuBuildSoundDevStr(const virDomainDef *def,
     const char *model = NULL;
 
     /* Hack for devices with different names in QEMU and libvirt */
-    switch ((virDomainSoundModel) sound->model) {
+    switch (sound->model) {
     case VIR_DOMAIN_SOUND_MODEL_ES1370:
         model = "ES1370";
         break;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index a73f30ddcb..e66efb3d1f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -759,7 +759,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef 
*dev,
     }
 
     case VIR_DOMAIN_DEVICE_SOUND:
-        switch ((virDomainSoundModel) dev->data.sound->model) {
+        switch (dev->data.sound->model) {
         case VIR_DOMAIN_SOUND_MODEL_ES1370:
         case VIR_DOMAIN_SOUND_MODEL_AC97:
         case VIR_DOMAIN_SOUND_MODEL_ICH6:
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 255d653118..774426bceb 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4385,7 +4385,7 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDef *sound,
 {
     size_t i;
 
-    switch ((virDomainSoundModel) sound->model) {
+    switch (sound->model) {
     case VIR_DOMAIN_SOUND_MODEL_USB:
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_USB_AUDIO)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-- 
2.26.3

Reply via email to