Coverity notes taht 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 Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 31cbccb..1c72844 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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))) -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list