]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Remove dead code
authorAndrea Bolognani <abologna@redhat.com>
Mon, 20 Feb 2017 14:56:18 +0000 (15:56 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 22 Feb 2017 17:55:54 +0000 (18:55 +0100)
The switch in virDomainPCIControllerModelToConnectType()
had some code that, while techically part of the
_PCIE_SWITCH_DOWNSTREAM_PORT case, was in fact dead due
to the early return.

Get rid of the dead code, and fix the inaccurate function
description while at it.

src/conf/domain_addr.c

index 1649d84eaa7d8c714350a66b0a9a6f80d285d64b..519cc6bb233c1711222ac8fdb3a4b315d435c096 100644 (file)
@@ -35,9 +35,8 @@ VIR_LOG_INIT("conf.domain_addr");
 virDomainPCIConnectFlags
 virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
 {
-    /* given a VIR_DOMAIN_CONTROLLER_MODEL_PCI*, set connectType to
-     * the equivalent VIR_PCI_CONNECT_TYPE_*. return 0 on success, -1
-     * if the model wasn't recognized.
+    /* given a VIR_DOMAIN_CONTROLLER_MODEL_PCI*, return
+     * the equivalent VIR_PCI_CONNECT_TYPE_*.
      */
     switch (model) {
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
@@ -70,14 +69,6 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
 
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
         return VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT;
-
-        /* if this happens, there is an error in the code. A
-         * PCI controller should always have a proper model
-         * set
-         */
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("PCI controller model incorrectly set to 'last'"));
-        return -1;
     }
     return 0;
 }