vdpa: Avoid duplicate call to vp_vdpa get_status
authorEugenio Pérez <eperezma@redhat.com>
Thu, 4 Nov 2021 19:58:33 +0000 (20:58 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 14 Jan 2022 23:50:52 +0000 (18:50 -0500)
It has no sense to call get_status twice, since we already have a
variable for that.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Link: https://lore.kernel.org/r/20211104195833.2089796-1-eperezma@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
drivers/vhost/vdpa.c

index e3c4f05..ed2aabf 100644 (file)
@@ -170,7 +170,7 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
         * Userspace shouldn't remove status bits unless reset the
         * status to 0.
         */
-       if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
+       if (status != 0 && (status_old & ~status) != 0)
                return -EINVAL;
 
        if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))