982648
From f8afd7a1499d50b812a48ebedb41ebfebff0e490 Mon Sep 17 00:00:00 2001
982648
Message-Id: <f8afd7a1499d50b812a48ebedb41ebfebff0e490@dist-git>
982648
From: Erik Skultety <eskultet@redhat.com>
982648
Date: Thu, 19 Jul 2018 15:03:56 +0200
982648
Subject: [PATCH] qemu: qemuBuildHostdevCommandLine: Use a helper variable
982648
 mdevsrc
982648
MIME-Version: 1.0
982648
Content-Type: text/plain; charset=UTF-8
982648
Content-Transfer-Encoding: 8bit
982648
982648
Decrease the number of accessors we have to use.
982648
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
(cherry picked from commit 3b61f333acd9266ff4f09e37515130d67d496f74)
982648
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 src/qemu/qemu_command.c | 5 ++++-
982648
 1 file changed, 4 insertions(+), 1 deletion(-)
982648
982648
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
982648
index 8a8cbfd7f6..fed4f8faf9 100644
982648
--- a/src/qemu/qemu_command.c
982648
+++ b/src/qemu/qemu_command.c
982648
@@ -5394,7 +5394,9 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
982648
 
982648
         /* MDEV */
982648
         if (virHostdevIsMdevDevice(hostdev)) {
982648
-            switch ((virMediatedDeviceModelType) subsys->u.mdev.model) {
982648
+            virDomainHostdevSubsysMediatedDevPtr mdevsrc = &subsys->u.mdev;
982648
+
982648
+            switch ((virMediatedDeviceModelType) mdevsrc->model) {
982648
             case VIR_MDEV_MODEL_TYPE_VFIO_PCI:
982648
                 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
982648
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
982648
@@ -5402,6 +5404,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
982648
                                      "supported by this version of QEMU"));
982648
                     return -1;
982648
                 }
982648
+
982648
                 break;
982648
             case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
982648
                 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW)) {
982648
-- 
982648
2.18.0
982648