vhost: infrastructure fixes for 3.16

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.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJTp8fJAAoJECgfDbjSjVRpMt8H/j7UiV5x1lTzhFxSBgIioqWR
 6eIzZTDHFOKWTT2Gh51s21+EkLZluDb7HZcWwTh8CMvawjbiJbhhLFiHDhDAWrWd
 pBMNtkhVNiOzAvvmyk2MJPNG/UqhRORS/+ULkGhD38BgI4Q44DW2Za9aKrfMEL9+
 GxN3s+IZbM2fMzWn3BCxfKs1XpbOZzO60PmmnuJ7ubhRSRZT0Ukr1vbAsKKD5tFY
 LBwoBIx9cuprKJ1WAgbnVatgspNbTkXqH2ygQuZKO5hEt5lOzr8uFm6B+ylsQ7bu
 WZWQbrMVuPnhmkRnbeZ13ItvF3yxnY5RYNScAp0aT0KUnMzZKpjY2KR409rmNcQ=
 =JnGJ
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2014-06-25 05:30:20 -07:00
Родитель b8e46d22dc 6840444155
Коммит 07f4695c62
2 изменённых файлов: 4 добавлений и 20 удалений

Просмотреть файл

@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work)
handle_rx(net);
}
static void vhost_net_free(void *addr)
{
if (is_vmalloc_addr(addr))
vfree(addr);
else
kfree(addr);
}
static int vhost_net_open(struct inode *inode, struct file *f)
{
struct vhost_net *n;
@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
}
vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL);
if (!vqs) {
vhost_net_free(n);
kvfree(n);
return -ENOMEM;
}
@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f)
* since jobs can re-queue themselves. */
vhost_net_flush(n);
kfree(n->dev.vqs);
vhost_net_free(n);
kvfree(n);
return 0;
}

Просмотреть файл

@ -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;
@ -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;
}
@ -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;
}