public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost/vsock: Micro optimize error handle
@ 2019-09-23  7:41 richard.peng
  0 siblings, 0 replies; only message in thread
From: richard.peng @ 2019-09-23  7:41 UTC (permalink / raw)
  To: mst, davem; +Cc: linux-kernel

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

Signed-off-by:Peng Hao <richard.peng@oppo.com>
---
 drivers/vhost/vsock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 6a50e1d..0bed19d 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-23  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-23  7:41 [PATCH] vhost/vsock: Micro optimize error handle richard.peng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox