Skip to content

Commit

Permalink
Initialize device with seg fault
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuda-Chen committed Oct 6, 2024
1 parent 7ee8f5c commit bedec2c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions virtio-snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

0 comments on commit bedec2c

Please sign in to comment.