[Qemu-devel] [PATCH] virtio-blk: remove duplicate definition of VirtIOBlock *s pointer

Stefano Garzarella posted 1 patch 6 years, 9 months ago
Test asan passed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190130095231.42081-1-sgarzare@redhat.com
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
hw/block/virtio-blk.c | 2 --
1 file changed, 2 deletions(-)
[Qemu-devel] [PATCH] virtio-blk: remove duplicate definition of VirtIOBlock *s pointer
Posted by Stefano Garzarella 6 years, 9 months ago
VirtIOBlock *s is already defined and initialized with req->dev
on top of virtio_blk_handle_request(), so we can remove it from
the code block of VIRTIO_BLK_T_GET_ID case.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
 hw/block/virtio-blk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index f208c6ddb9..9a87b3bfac 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -569,8 +569,6 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
         break;
     case VIRTIO_BLK_T_GET_ID:
     {
-        VirtIOBlock *s = req->dev;
-
         /*
          * NB: per existing s/n string convention the string is
          * terminated by '\0' only when shorter than buffer.
-- 
2.20.1


Re: [Qemu-devel] [PATCH] virtio-blk: remove duplicate definition of VirtIOBlock *s pointer
Posted by Thomas Huth 6 years, 9 months ago
On 2019-01-30 10:52, Stefano Garzarella wrote:
> VirtIOBlock *s is already defined and initialized with req->dev
> on top of virtio_blk_handle_request(), so we can remove it from
> the code block of VIRTIO_BLK_T_GET_ID case.
> 
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>  hw/block/virtio-blk.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index f208c6ddb9..9a87b3bfac 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -569,8 +569,6 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
>          break;
>      case VIRTIO_BLK_T_GET_ID:
>      {
> -        VirtIOBlock *s = req->dev;
> -
>          /*
>           * NB: per existing s/n string convention the string is
>           * terminated by '\0' only when shorter than buffer.
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

Re: [Qemu-devel] [Qemu-trivial] [PATCH] virtio-blk: remove duplicate definition of VirtIOBlock *s pointer
Posted by Laurent Vivier 6 years, 9 months ago
On 30/01/2019 10:52, Stefano Garzarella wrote:
> VirtIOBlock *s is already defined and initialized with req->dev
> on top of virtio_blk_handle_request(), so we can remove it from
> the code block of VIRTIO_BLK_T_GET_ID case.
> 
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>  hw/block/virtio-blk.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index f208c6ddb9..9a87b3bfac 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -569,8 +569,6 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
>          break;
>      case VIRTIO_BLK_T_GET_ID:
>      {
> -        VirtIOBlock *s = req->dev;
> -
>          /*
>           * NB: per existing s/n string convention the string is
>           * terminated by '\0' only when shorter than buffer.
> 

Applied to my trivial-patches branch.

Thanks,
Laurent