[PATCH] virtio: fix "warning: ‘queue’ may be used uninitialized"

Jeff Mahoney
2016-04-04T18:14:19Z

This fixes the following warning:
drivers/virtio/virtio_ring.c:1032:5: warning: ?queue? may be used
uninitialized in this function

The conditions that govern when queue is set aren't apparent to gcc.

Setting queue = NULL clears the warning.

Signed-off-by: Jeff Mahoney <jeffm at suse.com>
---

 drivers/virtio/virtio_ring.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1006,7 +1006,7 @@ struct virtqueue *vring_create_virtqueue
 	const char *name)
 {
 	struct virtqueue *vq;
-	void *queue;
+	void *queue = NULL;
 	dma_addr_t dma_addr;
 	size_t queue_size_in_bytes;
 	struct vring vring;

--
Jeff Mahoney
SUSE Labs