aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c12
1 files changed, 2 insertions, 10 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
703static void vhost_net_free(void *addr)
704{
705 if (is_vmalloc_addr(addr))
706 vfree(addr);
707 else
708 kfree(addr);
709}
710
711static int vhost_net_open(struct inode *inode, struct file *f) 703static 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