From: Martin Kletzander Date: Fri, 20 Jan 2023 09:28:52 +0000 (+0100) Subject: qemuDomainAttachWatchdog: Avoid unnecessary nesting X-Git-Tag: v9.1.0-rc1~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5340d5420012412ea298f0102cc7f113e87d89b;p=thirdparty%2Flibvirt.git qemuDomainAttachWatchdog: Avoid unnecessary nesting Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 070e0a051c..e153e4806d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2936,17 +2936,17 @@ qemuDomainAttachWatchdog(virDomainObj *vm, qemuAssignDeviceWatchdogAlias(watchdog); - if (watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) { - if (qemuDomainEnsurePCIAddress(vm, &dev) < 0) - goto cleanup; - releaseAddress = true; - } else { + if (watchdog->model != VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("hotplug of watchdog of model %s is not supported"), virDomainWatchdogModelTypeToString(watchdog->model)); goto cleanup; } + if (qemuDomainEnsurePCIAddress(vm, &dev) < 0) + goto cleanup; + releaseAddress = true; + if (!(props = qemuBuildWatchdogDevProps(vm->def, watchdog))) goto cleanup;