virtio-snd: check AUD_register_card return value

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 <manos.pitsidianakis@linaro.org>
Message-Id: <20231109162034.2108018-1-manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Manos Pitsidianakis 2023-11-09 18:20:35 +02:00 committed by Michael S. Tsirkin
parent e60bdfb78e
commit 691d3d8bbd

View File

@ -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;