
On 02/21/2017 02:57 PM, Andrea Bolognani wrote:
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 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 1649d84..519cc6b 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -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;
It looks like this code was added at a time when I thought that ..._LAST should be handled separately in order to catch errors where the model was improperly set to that one value, and then later I figured it was so unlikely for that to happen (vs. e.g. having it initialized to 0 and then never set) that it wasn't worth the code. So I moved the case ...._LAST: but forgot to remove the code. Anyway, ACK.