Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2080819pxb; Thu, 4 Nov 2021 13:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6acFTGSTiOzfsctjktO2PZ7LiXv1TQbAqKRApMvJcCbzw5/loJRtaMDQdACq4xMGZNDnF X-Received: by 2002:aa7:d494:: with SMTP id b20mr30398494edr.243.1636058592054; Thu, 04 Nov 2021 13:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636058592; cv=none; d=google.com; s=arc-20160816; b=Su4Cwo4Eh6EUx1E4DyQv9JTmaSUnED3DR+NeUPjIOLSQYTo37D20yPn/LjyC1l2DnY 9AlH2K+VMbvAfA+/lq6t3AEtOy14KATBbcJ/DHVeAkn6Hpf/teZIABMFTOUPOIGYz87H ARZYmovJU7YQQ5HJIeUe8xnRi9ash7t0wZjXKwqHN3L+DoDUCPtDCjulwgPWtGGduoCT QVHApNUPavR4dSTUHG/T5Ydxqa3IaJqi6WTbSmXd3Iv3QuiGKLEnh/k9/c/Q7pYo+Qd6 2Lc9Ji6dwMrjToCGwjNRGKYVy1u1t7cmnOLQgmLa3U3cJkzkoyY3afiRHncFnZlqiSvO LEYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z4lusGM7hW6yb6Tdfb4DRGhZ18YMdjS4zPghOdfTXPc=; b=hh8Be52jN3yuWUED7c2Ez7yfSWg76XiDUB/VbmICnNOVfLVAY1sZS9r67mRL3R+aOU njdjSKJlc5xgDD+S04I9O56lsT8kdG3SB2/o5YDiZFtSyBtkfEGFBF4QlaMHCw11xXr0 ydwupUaXDQqdkhaAsyt5nUyckw1KHIFxCQMncv5TLpcaXShHDLRriShUx643OuPGNPny jy42cC+HXo1lIyHH8omQpujpOBqKfmTKCxRfWaV5O/zFxjyc1pab+dC2zSAc3bujDVXt qSHVla6wSBewrEc7B7gk6vIXi1FgyJLlFmgeHuVnkV57p1gXlFIaD8NQhI9WcXF5+dPS 5Y8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Wap/+Hec"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si11871390edc.567.2021.11.04.13.42.48; Thu, 04 Nov 2021 13:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Wap/+Hec"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbhKDUBg (ORCPT + 99 others); Thu, 4 Nov 2021 16:01:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33177 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbhKDUB0 (ORCPT ); Thu, 4 Nov 2021 16:01:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636055927; 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=Wap/+Hecf/Fgm99RK0ThnDBfQS02FznVWeqv+AZUoNfwX5wat1cBAzTB9ii76V5R72WLTu tWgQAzPxHxcG5cVBra2MpyTiLf6E/9ZSvnA9JpLPxh/QBfuYedlwRuSFiuO0Q6vA3zTlFl miKthvQGbqO3a5HenmkZNrFfQeoqX3k= 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=20P=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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); -- 2.27.0