From 691d3d8bbde16abd002a2590fa422b079d0c8468 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 9 Nov 2023 18:20:35 +0200 Subject: virtio-snd: check AUD_register_card return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AUD_register_card might fail. Even though errp was passed as an argument, the call's return value was not checked for failure. Fixes: Coverity CID 1523899 Signed-off-by: Manos Pitsidianakis Message-Id: <20231109162034.2108018-1-manos.pitsidianakis@linaro.org> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/audio/virtio-snd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'hw/audio') diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index 2fe966e..83e9785 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -1102,7 +1102,9 @@ static void virtio_snd_realize(DeviceState *dev, Error **errp) return; } - AUD_register_card("virtio-sound", &vsnd->card, errp); + if (!AUD_register_card("virtio-sound", &vsnd->card, errp)) { + return; + } /* set default params for all streams */ default_params.features = 0; -- cgit v1.1