mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
vhost: remove the dead branch
Since vhost_dev_init() forever return 0, some branches are never run, therefore need to be removed. Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
941c22532f
commit
59566b6e8c
@ -683,7 +683,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
|
||||
struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
|
||||
struct vhost_dev *dev;
|
||||
struct vhost_virtqueue **vqs;
|
||||
int r, i;
|
||||
int i;
|
||||
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
@ -706,12 +706,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
|
||||
n->vqs[i].vhost_hlen = 0;
|
||||
n->vqs[i].sock_hlen = 0;
|
||||
}
|
||||
r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
|
||||
if (r < 0) {
|
||||
kfree(n);
|
||||
kfree(vqs);
|
||||
return r;
|
||||
}
|
||||
vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
|
||||
|
||||
vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
|
||||
vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
|
||||
|
@ -1417,18 +1417,13 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
|
||||
vqs[i] = &vs->vqs[i].vq;
|
||||
vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick;
|
||||
}
|
||||
r = vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
|
||||
vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
|
||||
|
||||
tcm_vhost_init_inflight(vs, NULL);
|
||||
|
||||
if (r < 0)
|
||||
goto err_init;
|
||||
|
||||
f->private_data = vs;
|
||||
return 0;
|
||||
|
||||
err_init:
|
||||
kfree(vqs);
|
||||
err_vqs:
|
||||
vhost_scsi_free(vs);
|
||||
err_vs:
|
||||
|
@ -104,7 +104,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
|
||||
struct vhost_test *n = kmalloc(sizeof *n, GFP_KERNEL);
|
||||
struct vhost_dev *dev;
|
||||
struct vhost_virtqueue **vqs;
|
||||
int r;
|
||||
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
@ -117,12 +116,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
|
||||
dev = &n->dev;
|
||||
vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
|
||||
n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
|
||||
r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
|
||||
if (r < 0) {
|
||||
kfree(vqs);
|
||||
kfree(n);
|
||||
return r;
|
||||
}
|
||||
vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
|
||||
|
||||
f->private_data = n;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
|
||||
vhost_vq_free_iovecs(dev->vqs[i]);
|
||||
}
|
||||
|
||||
long vhost_dev_init(struct vhost_dev *dev,
|
||||
void vhost_dev_init(struct vhost_dev *dev,
|
||||
struct vhost_virtqueue **vqs, int nvqs)
|
||||
{
|
||||
struct vhost_virtqueue *vq;
|
||||
@ -319,8 +319,6 @@ long vhost_dev_init(struct vhost_dev *dev,
|
||||
vhost_poll_init(&vq->poll, vq->handle_kick,
|
||||
POLLIN, dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vhost_dev_init);
|
||||
|
||||
|
@ -127,7 +127,7 @@ struct vhost_dev {
|
||||
struct task_struct *worker;
|
||||
};
|
||||
|
||||
long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
|
||||
void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
|
||||
long vhost_dev_set_owner(struct vhost_dev *dev);
|
||||
bool vhost_dev_has_owner(struct vhost_dev *dev);
|
||||
long vhost_dev_check_owner(struct vhost_dev *);
|
||||
|
Loading…
Reference in New Issue
Block a user