Skip to contentSkip to conversation

vhost-scsi: don't open-code kvfree

PATCH In review Michael S. Tsirkin 3 participants 3 messages Jun 12, 2014

Subsystems (6)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vhost-scsi: don't open-code kvfree

Now that we have kvfree, use it in vhost-scsi instead of the open-coded version.

Cc Nicholas Bellinger <[email protected]>

---

I have this queued for -rc2.
Nicholas could you review ack pls?

 drivers/vhost/scsi.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/vhost/scsi.c +2 -10
index 83b834b..b08863e 100644
@@ -1396,14 +1396,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;
@@ -1443,7 +1435,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;
 }
@@ -1462,7 +1454,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;
 }
 
Signature · 1 line
MST
maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 12/06/2014 18:02, Michael S. Tsirkin ha scritto:

Quoted 43 lines

Now that we have kvfree, use it in vhost-scsi instead of the open-coded version.

Cc Nicholas Bellinger <[email protected]>

---

I have this queued for -rc2.
Nicholas could you review ack pls?

 drivers/vhost/scsi.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/vhost/scsi.c +1 -9
index 83b834b..b08863e 100644
@@ -1396,14 +1396,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;
@@ -1443,7 +1435,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;
 }

drivers/vhost/scsi.c static int vhost_scsi_release(struct inode *inode, struct file *f) · line 1460

Quoted 8 lines
drivers/vhost/scsi.c +1 -1
@@ -1462,7 +1454,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;
 }
 

You didn't CC Nicholas. :) Anyway,

Paolo