From cb94ff5f80c537e43c04fa4f071f1df784255310 Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Mon, 2 Oct 2023 16:27:57 +0200 Subject: 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 [Reworked the audio/audio.c parts, while keeping Martin's hw/ changes. - Paolo] Signed-off-by: Paolo Bonzini --- hw/audio/lm4549.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'hw/audio/lm4549.c') diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 418041b..e7bfcc4 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -281,6 +281,11 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque, { struct audsettings as; + /* Register an audio card */ + if (!AUD_register_card("lm4549", &s->card, errp)) { + return; + } + /* Store the callback and opaque pointer */ s->data_req_cb = data_req_cb; s->opaque = opaque; @@ -288,9 +293,6 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque, /* Init the registers */ lm4549_reset(s); - /* Register an audio card */ - AUD_register_card("lm4549", &s->card); - /* Open a default voice */ as.freq = 48000; as.nchannels = 2; -- cgit v1.1