aboutsummaryrefslogtreecommitdiff
path: root/audio/sdlaudio.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-09-22 19:13:44 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-10-03 10:29:39 +0200
commitf6061733a96314ccb732efe6c91357d66f8970af (patch)
tree5abdb6f35d1cb78f5a46d4b7c79384070a317066 /audio/sdlaudio.c
parentaaa6a6f93dc88f9201b9872fa64a565d52628208 (diff)
audio: allow returning an error from the driver init
An error is already printed by audio_driver_init, but we can make it more precise if the driver can return an Error *. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'audio/sdlaudio.c')
-rw-r--r--audio/sdlaudio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index 68a237b76b..4d8473d9ec 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -26,6 +26,7 @@
#include <SDL.h>
#include <SDL_thread.h>
#include "qemu/module.h"
+#include "qapi/error.h"
#include "audio.h"
#ifndef _WIN32
@@ -449,10 +450,10 @@ static void sdl_enable_in(HWVoiceIn *hw, bool enable)
SDL_PauseAudioDevice(sdl->devid, !enable);
}
-static void *sdl_audio_init(Audiodev *dev)
+static void *sdl_audio_init(Audiodev *dev, Error **errp)
{
if (SDL_InitSubSystem (SDL_INIT_AUDIO)) {
- sdl_logerr ("SDL failed to initialize audio subsystem\n");
+ error_setg(errp, "SDL failed to initialize audio subsystem");
return NULL;
}