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 CB14FC433F5 for ; Fri, 24 Sep 2021 16:01:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4CD460E54 for ; Fri, 24 Sep 2021 16:01:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347253AbhIXQC6 (ORCPT ); Fri, 24 Sep 2021 12:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347186AbhIXQC5 (ORCPT ); Fri, 24 Sep 2021 12:02:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4526BC061571 for ; Fri, 24 Sep 2021 09:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=u+Fwh3FY3v88AJUR/voPvS9eUvIwQdqL+LN9kAeUZgo=; b=r+PT0NfrTc+EBy9dBzcODbZplR ssWHnYbIrwfs0vzrMvSJMbo5lz2agQDSHka7NAWf20PN3Aw3zOCZHfbmvxLYP0mWPMS66aXZlbKF7 ydEhGZHuQjk3SsQCD352ztZDdkrFXXmML+c2XlBZTql1LMK92gdvfVH0P1fNkUKBwpuXAWIjP62+h 8uRiQdQyB6MXf2O35kktCgswnbRqJ86tswvyZhALbjbjrEx+HYvV1L4DMVsuBy29IAvepwqtuqvJ0 UoiH74trB9dVgbpYgSWZT0SfkTyXkrYwjHW0HSaoHhST/L8hbvUp7raxaHAZN9s0GfxUJ2tECxSZl aEkt82Lw==; Received: from [2001:4bb8:184:72db:e8f6:c47e:192b:5622] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTnbZ-007N0F-HP; Fri, 24 Sep 2021 15:59:36 +0000 From: Christoph Hellwig To: Alex Williamson Cc: Diana Craciun , Cornelia Huck , Kirti Wankhede , Eric Auger , Jason Gunthorpe , Terrence Xu , kvm@vger.kernel.org, Jason Gunthorpe , Kevin Tian Subject: [PATCH 03/15] vfio: remove the iommudata check in vfio_noiommu_attach_group Date: Fri, 24 Sep 2021 17:56:53 +0200 Message-Id: <20210924155705.4258-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210924155705.4258-1-hch@lst.de> References: <20210924155705.4258-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org vfio_noiommu_attach_group has two callers: 1) __vfio_container_attach_groups is called by vfio_ioctl_set_iommu, which just called vfio_iommu_driver_allowed 2) vfio_group_set_container requires already checks ->noiommu on the vfio_group, which is propagated from the iommudata in vfio_create_group so this check is entirely superflous and can be removed. Signed-off-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- drivers/vfio/vfio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index faf8e0d637bb94..8bd4b0b96b94a3 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -240,7 +240,7 @@ static long vfio_noiommu_ioctl(void *iommu_data, static int vfio_noiommu_attach_group(void *iommu_data, struct iommu_group *iommu_group) { - return iommu_group_get_iommudata(iommu_group) == &noiommu ? 0 : -EINVAL; + return 0; } static void vfio_noiommu_detach_group(void *iommu_data, -- 2.30.2