qemu/hw/audio
Manos Pitsidianakis f785618184 virtio-sound: add realize() error cleanup path
QEMU crashes on exit when a virtio-sound device has failed to
realise. Its vmstate field was not cleaned up properly with
qemu_del_vm_change_state_handler().

This patch changes the realize() order as

1. Validate the given configuration values (no resources allocated
   by us either on success or failure)
2. Try AUD_register_card() and return on failure (no resources allocated
   by us on failure)
3. Initialize vmstate, virtio device, heap allocations and stream
   parameters at once.
   If error occurs, goto error_cleanup label which calls
   virtio_snd_unrealize(). This cleans up all resources made in steps
   1-3.

Reported-by: Volker Rümelin <vr_qemu@t-online.de>
Fixes: 2880e676c0 ("Add virtio-sound device stub")
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20231116072046.4002957-1-manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-12-02 15:56:49 -05:00
..
ac97.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
ac97.h hw/audio/ac97: Split off some definitions to a header 2023-02-27 22:29:02 +01:00
adlib.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
asc.c asc: generate silence if FIFO empty but engine still running 2023-10-06 10:33:43 +02:00
cs4231.c hw: Replace anti-social QOM type names 2021-03-19 15:18:43 +01:00
cs4231a.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
es1370.c hw/audio/es1370: Clean up comment 2023-11-13 11:35:47 +01:00
fmopl.c audio: spelling fixes 2023-09-08 13:08:52 +03:00
fmopl.h audio: spelling fixes 2023-09-08 13:08:52 +03:00
gus.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
gusemu_hal.c audio: spelling fixes 2023-09-08 13:08:52 +03:00
gusemu_mixer.c hw/audio/gus: Fix registers 32-bit access 2020-06-19 11:20:09 +02:00
gusemu.h
gustate.h
hda-codec-common.h
hda-codec.c hw/audio/hda-codec: reenable the audio mixer 2023-12-02 15:56:49 -05:00
intel-hda-defs.h audio: spelling fixes 2023-09-08 13:08:52 +03:00
intel-hda.c hw/audio: Simplify hda audio init 2023-09-22 16:30:07 +02:00
intel-hda.h hw/audio: Simplify hda audio init 2023-09-22 16:30:07 +02:00
Kconfig Add virtio-sound device stub 2023-11-07 03:39:10 -05:00
lm4549.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
lm4549.h hw/audio/lm4549: Add errp error reporting to init function 2023-09-22 16:30:07 +02:00
marvell_88w8618.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
meson.build Add virtio-sound-pci device 2023-11-07 03:39:10 -05:00
pcspk.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
pl041.c hw/audio/lm4549: Add errp error reporting to init function 2023-09-22 16:30:07 +02:00
pl041.h
pl041.hx
sb16.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00
soundhw.c hw/audio/soundhw: Clean up global variable shadowing 2023-10-06 13:16:57 +02:00
trace-events virtio-sound: implement audio capture (RX) 2023-11-07 03:39:10 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
via-ac97.c hw/audio/via-ac97: Route interrupts using via_isa_set_irq() 2023-11-28 14:26:37 +01:00
virtio-snd-pci.c hw/audio/virtio-snd-pci: fix the PCI class code 2023-12-02 15:56:49 -05:00
virtio-snd.c virtio-sound: add realize() error cleanup path 2023-12-02 15:56:49 -05:00
wm8750.c audio: propagate Error * out of audio_init 2023-10-03 10:29:40 +02:00