1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Resolve Coverity DEADCODE

Coverity notes that the switch() used to check 'connected' values has
two DEADCODE paths (_DEFAULT & _LAST).  Since 'connected' is a boolean
it can only be one or the other (CONNECTED or DISCONNECTED), so it just
seems pointless to use a switch to get "all" values.  Convert to if-else
This commit is contained in:
John Ferlan 2015-04-27 07:25:22 -04:00
parent 1f7e811249
commit d8082d2d44

View File

@ -4497,8 +4497,7 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
goto endjob;
if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0")) {
switch (newstate) {
case VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED:
if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) {
if (!priv->agent) {
if ((rc = qemuConnectAgent(driver, vm)) == -2)
goto endjob;
@ -4506,20 +4505,13 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
if (rc < 0)
priv->agentError = true;
}
break;
case VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED:
} else {
if (priv->agent) {
qemuAgentClose(priv->agent);
priv->agent = NULL;
priv->agentError = false;
}
break;
case VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT:
case VIR_DOMAIN_CHR_DEVICE_STATE_LAST:
break;
};
}
if ((event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL)))