From patchwork Thu Nov 4 19:58:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 12603745 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65DD2C433FE for ; Thu, 4 Nov 2021 19:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 516CE61213 for ; Thu, 4 Nov 2021 19:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbhKDUBi (ORCPT ); Thu, 4 Nov 2021 16:01:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60292 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbhKDUB1 (ORCPT ); Thu, 4 Nov 2021 16:01:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636055929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z4lusGM7hW6yb6Tdfb4DRGhZ18YMdjS4zPghOdfTXPc=; b=RsDxAa88Nx/yzC6qhs12dvSvPbG4Suj2dXQMI/4KyMCA7IdqabdBTEtMIpzEXXswNxZ+Br DOjvHIcPXdzLjmJFWeoDRSsoBzh0ZN4gkWyN2oaOVpvSpCDoJVxC1v1vaUuyRQno/fFsOq fcYLdOmuVG593ft42r6IV2/Al6gpv2o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-YH74HwnqOkK0sgQ_HEodwQ-1; Thu, 04 Nov 2021 15:58:45 -0400 X-MC-Unique: YH74HwnqOkK0sgQ_HEodwQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF5051054F93; Thu, 4 Nov 2021 19:58:44 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CCF71007625; Thu, 4 Nov 2021 19:58:37 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Jason Wang Subject: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status Date: Thu, 4 Nov 2021 20:58:33 +0100 Message-Id: <20211104195833.2089796-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It has no sense to call get_status twice, since we already have a variable for that. Signed-off-by: Eugenio PĂ©rez Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 01c59ce7e250..10676ea0348b 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) status_old = ops->get_status(vdpa); /* * 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)) for (i = 0; i < nvqs; i++) vhost_vdpa_unsetup_vq_irq(v, i);