From: Peter Krempa Date: Tue, 16 Nov 2021 09:10:16 +0000 (+0100) Subject: qemuMonitorJSONAttachCharDevGetProps: Simplify handling of unsupported types X-Git-Tag: v7.10.0-rc1~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dbb7cef70dfa460e08d7005f6b49bbb82cb5492;p=thirdparty%2Flibvirt.git qemuMonitorJSONAttachCharDevGetProps: Simplify handling of unsupported types Use 'virReportEnumRangeError' for the invalid cases and keep the original error for known but unsupported chardevs. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b036cc4112..1ced942161 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6737,16 +6737,14 @@ qemuMonitorJSONAttachCharDevGetProps(const char *chrID, case VIR_DOMAIN_CHR_TYPE_PIPE: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_NMDM: + virReportError(VIR_ERR_OPERATION_FAILED, + _("Hotplug unsupported for char device type '%s'"), + virDomainChrTypeToString(chr->type)); + return NULL; + case VIR_DOMAIN_CHR_TYPE_LAST: - if (virDomainChrTypeToString(chr->type)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Hotplug unsupported for char device type '%s'"), - virDomainChrTypeToString(chr->type)); - } else { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Hotplug unsupported for char device type '%d'"), - chr->type); - } + default: + virReportEnumRangeError(virDomainChrType, chr->type); return NULL; }