From 5b3ca87079e7a356ba0036ebb0be0a37def35e38 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 11 May 2026 20:03:16 +1000 Subject: virtio: Reduce scope of variable As cppcheck points out, the 'min' variable in vu_log_queue_fill() can have its scope reduced. Do so. Signed-off-by: David Gibson Reviewed-by: Laurent Vivier Signed-off-by: Stefano Brivio --- virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtio.c b/virtio.c index b283de6..d7016cc 100644 --- a/virtio.c +++ b/virtio.c @@ -630,9 +630,9 @@ static void vu_log_queue_fill(const struct vu_dev *vdev, struct vu_virtq *vq, { struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE]; struct vring_desc *desc = vq->vring.desc; - unsigned int max, min; unsigned num_bufs = 0; uint64_t read_len; + unsigned int max; if (!vdev->log_table || !len || !vu_has_feature(vdev, VHOST_F_LOG_ALL)) return; @@ -672,7 +672,7 @@ static void vu_log_queue_fill(const struct vu_dev *vdev, struct vu_virtq *vq, die("Looped descriptor"); if (le16toh(desc[index].flags) & VRING_DESC_F_WRITE) { - min = MIN(le32toh(desc[index].len), len); + unsigned min = MIN(le32toh(desc[index].len), len); vu_log_write(vdev, le64toh(desc[index].addr), min); len -= min; } -- cgit v1.2.3