From bedec2ce19e6c12bfc6cd634a747c98d01e94847 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Sun, 6 Oct 2024 16:11:43 +0800 Subject: [PATCH] Initialize device with seg fault --- virtio-snd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/virtio-snd.c b/virtio-snd.c index d0c5448c..b41a1d42 100644 --- a/virtio-snd.c +++ b/virtio-snd.c @@ -14,7 +14,7 @@ #define VSND_QUEUE_NUM_MAX 1024 #define vsndq (vsnd->queues[vsnd->QueueSel]) -#define PRIV(x) ((struct virtio_snd_config_t *) x->priv) +#define PRIV(x) ((virtio_snd_config_t *) x->priv) /* supported virtio sound version */ enum { @@ -721,11 +721,14 @@ bool virtio_snd_init(virtio_snd_state_t *vsnd) audio_host = CNFAInit(NULL, "semu-virtio-snd", virtio_snd_cb, 44100, 0, 1, 0, 1024, NULL, NULL, &guest_playing); - if (!audio_host) { fprintf(stderr, "virtio-snd driver initialization failed.\n"); return false; } + PRIV(vsnd)->jacks = 1; + PRIV(vsnd)->streams = 1; + PRIV(vsnd)->chmaps = 1; + return true; }