Skip to content

Commit

Permalink
vhost-scsi: don't open-code kvfree
Browse files Browse the repository at this point in the history
Now that we have kvfree, use it in vhost-scsi instead of
the open-coded version.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Jun 23, 2014
1 parent d04257b commit 6840444
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/vhost/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
return 0;
}

static void vhost_scsi_free(struct vhost_scsi *vs)
{
if (is_vmalloc_addr(vs))
vfree(vs);
else
kfree(vs);
}

static int vhost_scsi_open(struct inode *inode, struct file *f)
{
struct vhost_scsi *vs;
Expand Down Expand Up @@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
return 0;

err_vqs:
vhost_scsi_free(vs);
kvfree(vs);
err_vs:
return r;
}
Expand All @@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f)
/* Jobs can re-queue themselves in evt kick handler. Do extra flush. */
vhost_scsi_flush(vs);
kfree(vs->dev.vqs);
vhost_scsi_free(vs);
kvfree(vs);
return 0;
}

Expand Down

0 comments on commit 6840444

Please sign in to comment.