Patchwork virtio-blk: remove dead variable in virtio_blk_handle_scsi

login
register
mail settings
Submitter Christoph Hellwig
Date Jan. 13, 2010, 12:30 p.m.
Message ID <20100113123032.GA5728@lst.de>
Download mbox | patch
Permalink /patch/42815/
State New
Headers show

Comments

Christoph Hellwig - Jan. 13, 2010, 12:30 p.m.
As pointed out by clang size is only ever written to, but never actually
used. 

Signed-off-by: Christoph Hellwig <hch@lst.de>
Anthony Liguori - Jan. 13, 2010, 11:27 p.m.
On 01/13/2010 06:30 AM, Christoph Hellwig wrote:
> As pointed out by clang size is only ever written to, but never actually
> used.
>
> Signed-off-by: Christoph Hellwig<hch@lst.de>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> Index: qemu/hw/virtio-blk.c
> ===================================================================
> --- qemu.orig/hw/virtio-blk.c	2010-01-13 13:25:00.911004071 +0100
> +++ qemu/hw/virtio-blk.c	2010-01-13 13:25:17.014006323 +0100
> @@ -165,7 +165,7 @@ static VirtIOBlockReq *virtio_blk_get_re
>   static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
>   {
>       struct sg_io_hdr hdr;
> -    int ret, size = 0;
> +    int ret;
>       int status;
>       int i;
>
> @@ -194,7 +194,6 @@ static void virtio_blk_handle_scsi(VirtI
>        * before the regular inhdr.
>        */
>       req->scsi = (void *)req->elem.in_sg[req->elem.in_num - 2].iov_base;
> -    size = sizeof(*req->in) + sizeof(*req->scsi);
>
>       memset(&hdr, 0, sizeof(struct sg_io_hdr));
>       hdr.interface_id = 'S';
> @@ -226,7 +225,6 @@ static void virtio_blk_handle_scsi(VirtI
>               hdr.dxfer_len += req->elem.in_sg[i].iov_len;
>
>           hdr.dxferp = req->elem.in_sg;
> -        size += hdr.dxfer_len;
>       } else {
>           /*
>            * Some SCSI commands don't actually transfer any data.
> @@ -236,7 +234,6 @@ static void virtio_blk_handle_scsi(VirtI
>
>       hdr.sbp = req->elem.in_sg[req->elem.in_num - 3].iov_base;
>       hdr.mx_sb_len = req->elem.in_sg[req->elem.in_num - 3].iov_len;
> -    size += hdr.mx_sb_len;
>
>       ret = bdrv_ioctl(req->dev->bs, SG_IO,&hdr);
>       if (ret) {
>
>
>
>

Patch

Index: qemu/hw/virtio-blk.c
===================================================================
--- qemu.orig/hw/virtio-blk.c	2010-01-13 13:25:00.911004071 +0100
+++ qemu/hw/virtio-blk.c	2010-01-13 13:25:17.014006323 +0100
@@ -165,7 +165,7 @@  static VirtIOBlockReq *virtio_blk_get_re
 static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
 {
     struct sg_io_hdr hdr;
-    int ret, size = 0;
+    int ret;
     int status;
     int i;
 
@@ -194,7 +194,6 @@  static void virtio_blk_handle_scsi(VirtI
      * before the regular inhdr.
      */
     req->scsi = (void *)req->elem.in_sg[req->elem.in_num - 2].iov_base;
-    size = sizeof(*req->in) + sizeof(*req->scsi);
 
     memset(&hdr, 0, sizeof(struct sg_io_hdr));
     hdr.interface_id = 'S';
@@ -226,7 +225,6 @@  static void virtio_blk_handle_scsi(VirtI
             hdr.dxfer_len += req->elem.in_sg[i].iov_len;
 
         hdr.dxferp = req->elem.in_sg;
-        size += hdr.dxfer_len;
     } else {
         /*
          * Some SCSI commands don't actually transfer any data.
@@ -236,7 +234,6 @@  static void virtio_blk_handle_scsi(VirtI
 
     hdr.sbp = req->elem.in_sg[req->elem.in_num - 3].iov_base;
     hdr.mx_sb_len = req->elem.in_sg[req->elem.in_num - 3].iov_len;
-    size += hdr.mx_sb_len;
 
     ret = bdrv_ioctl(req->dev->bs, SG_IO, &hdr);
     if (ret) {