aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-audio.c
diff options
context:
space:
mode:
authorMartin Kletzander <mkletzan@redhat.com>2023-10-02 16:27:57 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-10-03 10:29:40 +0200
commitcb94ff5f80c537e43c04fa4f071f1df784255310 (patch)
tree18907d34d44c8e344ea2174c5bd80e6fa8dc5169 /hw/usb/dev-audio.c
parent9dcb64c96073e9898105cdbef6553cfef0fadcdb (diff)
audio: propagate Error * out of audio_init
Starting from audio_driver_init, propagate errors via Error ** so that audio_init_audiodevs can simply pass &error_fatal, and AUD_register_card can signal faiure. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> [Reworked the audio/audio.c parts, while keeping Martin's hw/ changes. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/usb/dev-audio.c')
-rw-r--r--hw/usb/dev-audio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
index 8748c1ba04..d5ac1f8962 100644
--- a/hw/usb/dev-audio.c
+++ b/hw/usb/dev-audio.c
@@ -944,12 +944,15 @@ static void usb_audio_realize(USBDevice *dev, Error **errp)
USBAudioState *s = USB_AUDIO(dev);
int i;
+ if (!AUD_register_card(TYPE_USB_AUDIO, &s->card, errp)) {
+ return;
+ }
+
dev->usb_desc = s->multi ? &desc_audio_multi : &desc_audio;
usb_desc_create_serial(dev);
usb_desc_init(dev);
s->dev.opaque = s;
- AUD_register_card(TYPE_USB_AUDIO, &s->card);
s->out.altset = ALTSET_OFF;
s->out.vol.mute = false;