Report the error from 'qemuValidateDomainWatchdogDef' rather than
'qemuBuildWatchdogDevStr'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 10 +++-------
src/qemu/qemu_validate.c | 4 +++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 19b1119e4a..bd34c6b48e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3688,14 +3688,10 @@ qemuBuildWatchdogDevStr(const virDomainDef *def,
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- const char *model = virDomainWatchdogModelTypeToString(dev->model);
- if (!model) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("missing watchdog model"));
- return NULL;
- }
+ virBufferAsprintf(&buf, "%s,id=%s",
+ virDomainWatchdogModelTypeToString(dev->model),
+ dev->info.alias);
- virBufferAsprintf(&buf, "%s,id=%s", model, dev->info.alias);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info) < 0)
return NULL;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index c84508cb64..8a779f24c7 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2102,7 +2102,9 @@ qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev,
break;
case VIR_DOMAIN_WATCHDOG_MODEL_LAST:
- break;
+ default:
+ virReportEnumRangeError(virDomainWatchdogModel, dev->model);
+ return -1;
}
return 0;
--
2.31.1