diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-25 08:30:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-25 08:30:20 -0400 |
commit | 07f4695c62629a7035583ebc344e8b2a8953d61c (patch) | |
tree | 16ee134ab86f3e8c59c7d7b8625e9f6c3640112d | |
parent | b8e46d22dc7cb66c70aeec57fff6101dbd96f30d (diff) | |
parent | 68404441557d8db5ac853379a4fb9c1adedea4fd (diff) |
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull vhost cleanups from Michael S Tsirkin:
"Two cleanup patches removing code duplication that got introduced by
changes in rc1. Not fixing crashes, but I'd rather not carry the
duplicate code until the next merge window"
* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
vhost-scsi: don't open-code kvfree
vhost-net: don't open-code kvfree
-rw-r--r-- | drivers/vhost/net.c | 12 | ||||
-rw-r--r-- | drivers/vhost/scsi.c | 12 |
2 files changed, 4 insertions, 20 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 971a760af4a1..8dae2f724a35 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work) | |||
700 | handle_rx(net); | 700 | handle_rx(net); |
701 | } | 701 | } |
702 | 702 | ||
703 | static void vhost_net_free(void *addr) | ||
704 | { | ||
705 | if (is_vmalloc_addr(addr)) | ||
706 | vfree(addr); | ||
707 | else | ||
708 | kfree(addr); | ||
709 | } | ||
710 | |||
711 | static int vhost_net_open(struct inode *inode, struct file *f) | 703 | static int vhost_net_open(struct inode *inode, struct file *f) |
712 | { | 704 | { |
713 | struct vhost_net *n; | 705 | struct vhost_net *n; |
@@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
723 | } | 715 | } |
724 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); | 716 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); |
725 | if (!vqs) { | 717 | if (!vqs) { |
726 | vhost_net_free(n); | 718 | kvfree(n); |
727 | return -ENOMEM; | 719 | return -ENOMEM; |
728 | } | 720 | } |
729 | 721 | ||
@@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
840 | * since jobs can re-queue themselves. */ | 832 | * since jobs can re-queue themselves. */ |
841 | vhost_net_flush(n); | 833 | vhost_net_flush(n); |
842 | kfree(n->dev.vqs); | 834 | kfree(n->dev.vqs); |
843 | vhost_net_free(n); | 835 | kvfree(n); |
844 | return 0; | 836 | return 0; |
845 | } | 837 | } |
846 | 838 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4f4ffa4c604e..69906cacd04f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |||
1503 | return 0; | 1503 | return 0; |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | static void vhost_scsi_free(struct vhost_scsi *vs) | ||
1507 | { | ||
1508 | if (is_vmalloc_addr(vs)) | ||
1509 | vfree(vs); | ||
1510 | else | ||
1511 | kfree(vs); | ||
1512 | } | ||
1513 | |||
1514 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 1506 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
1515 | { | 1507 | { |
1516 | struct vhost_scsi *vs; | 1508 | struct vhost_scsi *vs; |
@@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
1550 | return 0; | 1542 | return 0; |
1551 | 1543 | ||
1552 | err_vqs: | 1544 | err_vqs: |
1553 | vhost_scsi_free(vs); | 1545 | kvfree(vs); |
1554 | err_vs: | 1546 | err_vs: |
1555 | return r; | 1547 | return r; |
1556 | } | 1548 | } |
@@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
1569 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ | 1561 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ |
1570 | vhost_scsi_flush(vs); | 1562 | vhost_scsi_flush(vs); |
1571 | kfree(vs->dev.vqs); | 1563 | kfree(vs->dev.vqs); |
1572 | vhost_scsi_free(vs); | 1564 | kvfree(vs); |
1573 | return 0; | 1565 | return 0; |
1574 | } | 1566 | } |
1575 | 1567 | ||