scsi: Drop superfluous conditionals around g_free()
authorMarkus Armbruster <armbru@redhat.com>
Thu, 4 Dec 2014 13:12:43 +0000 (14:12 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Dec 2014 11:21:02 +0000 (12:21 +0100)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-generic.c

index 6b9e4e1ef9a2601dab054e3658588b959a0df8c3..e53470f85ef2189dadce2c206cb5a7a3623fa9d4 100644 (file)
@@ -298,8 +298,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
 #endif
 
     if (r->req.cmd.xfer == 0) {
-        if (r->buf != NULL)
-            g_free(r->buf);
+        g_free(r->buf);
         r->buflen = 0;
         r->buf = NULL;
         /* The request is used as the AIO opaque value, so add a ref.  */
@@ -314,8 +313,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
     }
 
     if (r->buflen != r->req.cmd.xfer) {
-        if (r->buf != NULL)
-            g_free(r->buf);
+        g_free(r->buf);
         r->buf = g_malloc(r->req.cmd.xfer);
         r->buflen = r->req.cmd.xfer;
     }