Patchwork [2/4] scsi-disk: qemu_vfree(NULL) is fine, simplify

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 15, 2013, 1:23 p.m.
Message ID <1358256220-5460-3-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/212155/
State New
Headers show

Comments

Markus Armbruster - Jan. 15, 2013, 1:23 p.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/scsi-disk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Paolo Bonzini - Jan. 15, 2013, 3:17 p.m.
Il 15/01/2013 14:23, Markus Armbruster ha scritto:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/scsi-disk.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
> index f8d7ef3..96db9a7 100644
> --- a/hw/scsi-disk.c
> +++ b/hw/scsi-disk.c
> @@ -85,9 +85,7 @@ static void scsi_free_request(SCSIRequest *req)
>  {
>      SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
>  
> -    if (r->iov.iov_base) {
> -        qemu_vfree(r->iov.iov_base);
> -    }
> +    qemu_vfree(r->iov.iov_base);
>  }
>  
>  /* Helper function for command completion with sense.  */
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index f8d7ef3..96db9a7 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -85,9 +85,7 @@  static void scsi_free_request(SCSIRequest *req)
 {
     SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
 
-    if (r->iov.iov_base) {
-        qemu_vfree(r->iov.iov_base);
-    }
+    qemu_vfree(r->iov.iov_base);
 }
 
 /* Helper function for command completion with sense.  */