diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-01-12 19:45:04 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-01-19 22:46:30 +0100 |
commit | 532e15af105a0b86211f515bd5fec1f4cdd9f27b (patch) | |
tree | 7c415c34879a27efbbbb4862f3fdbd2ebfcac42e /drivers/vhost | |
parent | vhost: scsi: constify target_core_fabric_ops structures (diff) | |
download | linux-532e15af105a0b86211f515bd5fec1f4cdd9f27b.tar.xz linux-532e15af105a0b86211f515bd5fec1f4cdd9f27b.zip |
vhost/scsi: silence uninitialized variable warning
This is to silence an uninitialized variable warning in debug output.
The problem is this line:
pr_debug("vhost_get_vq_desc: head: %d, out: %u in: %u\n",
head, out, in);
If "head == vq->num" is true on the first iteration then "out" and "in"
aren't initialized. We handle that a few lines after the printk. I was
tempted to just delete the pr_debug() but I decided to just initialize
them to zero instead.
Also checkpatch.pl complains if variables are declared as just
"unsigned" without the "int".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/scsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 620366dff754..fd6c8b66f06f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -843,7 +843,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) struct iov_iter out_iter, in_iter, prot_iter, data_iter; u64 tag; u32 exp_data_len, data_direction; - unsigned out, in; + unsigned int out = 0, in = 0; int head, ret, prot_bytes; size_t req_size, rsp_size = sizeof(struct virtio_scsi_cmd_resp); size_t out_size, in_size; |