Skip to contentSkip to conversation

vhost/vsock: Micro optimize error handle

PATCH New [email protected] 1 participant 1 message Sep 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost/vsock: Micro optimize error handle

When a vq error, there is no need to operate on the unmodified vq.

---
 drivers/vhost/vsock.c | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/vhost/vsock.c +0 -0
index 6a50e1d..0bed19d 100644
@@ -437,7 +437,7 @@ static void vhost_vsock_handle_rx_kick(struct vhost_work *work)

 static int vhost_vsock_start(struct vhost_vsock *vsock)
 {
  struct vhost_virtqueue *vq;
- size_t i;
+ size_t i, j;
  int ret;

  mutex_lock(&vsock->dev.mutex);
@@ -473,8 +473,8 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) vq->private_data = NULL;
  mutex_unlock(&vq->mutex);

- for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {
- vq = &vsock->vqs[i];
+ for (j = 0; j < i; j++) {
+ vq = &vsock->vqs[j];

  mutex_lock(&vq->mutex);
  vq->private_data = NULL;
--
2.7.4