[PATCH 06/18] ui/vnc: Require audiodev=

Martin Kletzander mkletzan at redhat.com
Mon Apr 25 08:21:49 UTC 2022


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 ui/vnc.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index badf1d7664fe..2e7af139b030 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4188,12 +4188,15 @@ void vnc_display_open(const char *id, Error **errp)
     vd->ledstate = 0;
 
     audiodev = qemu_opt_get(opts, "audiodev");
-    if (audiodev) {
-        vd->audio_state = audio_state_by_name(audiodev);
-        if (!vd->audio_state) {
-            error_setg(errp, "Audiodev '%s' not found", audiodev);
-            goto fail;
-        }
+    if (!audiodev) {
+        error_setg(errp, "Audiodev parameter for vnc required");
+        goto fail;
+    }
+
+    vd->audio_state = audio_state_by_name(audiodev);
+    if (!vd->audio_state) {
+        error_setg(errp, "Audiodev '%s' not found", audiodev);
+        goto fail;
     }
 
     device_id = qemu_opt_get(opts, "display");
-- 
2.35.1



More information about the libvir-list mailing list