Some variables are only used for PCI controllers, and we're going
to add more soon. We can declare them in the 'case' scope rather
than in the function scope to make it a bit nicer.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 src/qemu/qemu_command.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5e4dfcf75..2291bf5da 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2625,8 +2625,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     int address_type = def->info.type;
-    const virDomainPCIControllerOpts *pciopts;
-    const char *modelName = NULL;
 
     *devstr = NULL;
 
@@ -2726,7 +2724,10 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
 
         break;
 
-    case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
+    case VIR_DOMAIN_CONTROLLER_TYPE_PCI: {
+        const virDomainPCIControllerOpts *pciopts;
+        const char *modelName = NULL;
+
         pciopts = &def->opts.pciopts;
         if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT &&
             def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST)
@@ -2781,6 +2782,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
             goto error;
         }
         break;
+    }
 
     case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
     case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to