I have seen this pattern a lot in the project, so I decided to rewrite code I stumbled upon to the same pattern as well. Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1959b639da..b938687189 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16231,10 +16231,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; - if (ret < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) goto endjob; + ret = -1; } @@ -16362,9 +16361,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, } qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid, &reply); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; - if (ret < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) goto endjob; } @@ -17375,10 +17372,7 @@ qemuDomainSetTime(virDomainPtr dom, if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) { qemuDomainObjEnterMonitor(driver, vm); rv = qemuMonitorRTCResetReinjection(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; - - if (rv < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) goto endjob; } -- 2.31.1