hw/virtio: fix -Werror=maybe-uninitialized

../hw/virtio/vhost-shadow-virtqueue.c:545:13: error: ‘r’ may be used uninitialized [-Werror=maybe-uninitialized]

Set `r` to 0 at every loop, since we don't check vhost_svq_get_buf()
return value.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-03-28 14:20:51 +04:00
parent 4770030bcb
commit 3073c6b995

View File

@ -526,10 +526,10 @@ static void vhost_svq_flush(VhostShadowVirtqueue *svq,
size_t vhost_svq_poll(VhostShadowVirtqueue *svq, size_t num)
{
size_t len = 0;
uint32_t r;
while (num--) {
int64_t start_us = g_get_monotonic_time();
uint32_t r = 0;
do {
if (vhost_svq_more_used(svq)) {