Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4619847rwb; Wed, 17 Aug 2022 03:20:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5b1uQjVo44SKhkt6fJ8EPpCVdUJ5EKKpXXsAvU+GNhI4KLBY6TkuGgHVOwZi+1r0BoFK0B X-Received: by 2002:a05:6a00:842:b0:52e:2515:d657 with SMTP id q2-20020a056a00084200b0052e2515d657mr24444134pfk.31.1660731636727; Wed, 17 Aug 2022 03:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660731636; cv=none; d=google.com; s=arc-20160816; b=YKEA18uLFILCZYEvBhob+u0HbXdtQByasIPPDJlHBnDH/KMds4MoO6d2i8Q7umu5q0 SXZSub21BTOvAxpWJApIDOt9uJcj3o5fthvSbaasqt31Sm96FCfMdyc856WvKO87VEDV TpCckg9BMsQtECQpMhYPRZ/HaTLmuqPUtkjR9Ba/7gMuUvqnEyi5sZm2ul9/o2GOdngL ODxH0Cpo7t5/+jU0JY8H4KsOqRKciYYT2oamPv4WW4Ht6QwSPnQXeCN7kpV3Vg1g9KVA MuaaXoy8Xw+1bVrxiQu1xLUKTiQDiUQcDat4IDXMERPPYYBnFHMSIt78XLjM5EbNUhB+ 0cow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=mt10PXmdcE8DmNvGWr43Z10DV19utBQHyDsuvqbN9ac=; b=Z1ymCIBfBLq7rgROnqdliEfH/fbHzL0A54Chy0cz08+tqLb6N+MkAd5FafKAxjMCCV R1iSCCSa0EXy9uX1rUoqfwbDYvRdk/cZqlqA9lahnVAq9/fuEbBib6DggH78OfJwZa/E RmgOshhwPiGn9s0s+LAfaTRSxELyUB7qXgZStMHFRsi1Yo5l0yRhV2oFNNH++80OmoOO QyaO/Ip033AlbumQlFGDrZR4Jex0V8BTXxp8DxKlQ2eluYtSAa5c/eXTnEIQV1z6iX16 8wos6nxZB5rKj7C5g3K3PjnLnEadC3yETmXXXBR9+C2CoUM1EmJyBrCU3K3RxCdC319g jLGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a17090aac1000b001f302511306si1328711pjq.86.2022.08.17.03.20.26; Wed, 17 Aug 2022 03:20:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234388AbiHQKQR (ORCPT + 99 others); Wed, 17 Aug 2022 06:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbiHQKQN (ORCPT ); Wed, 17 Aug 2022 06:16:13 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1478554CB2 for ; Wed, 17 Aug 2022 03:16:13 -0700 (PDT) Received: from fraeml745-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M73h560fhz67Prk; Wed, 17 Aug 2022 18:11:17 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml745-chm.china.huawei.com (10.206.15.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 17 Aug 2022 12:16:11 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 17 Aug 2022 11:16:09 +0100 From: John Garry To: , , CC: , , John Garry Subject: [PATCH 1/3] iova: Remove some magazine pointer NULL checks Date: Wed, 17 Aug 2022 18:09:42 +0800 Message-ID: <1660730984-30333-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1660730984-30333-1-git-send-email-john.garry@huawei.com> References: <1660730984-30333-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 32e92d9f6f87 ("iommu/iova: Separate out rcache init") it has not been possible to have NULL CPU rcache "loaded" or "prev" magazine pointers. As such, the checks in iova_magazine_full(), iova_magazine_empty(), and iova_magazine_free_pfns() may be dropped. Signed-off-by: John Garry --- drivers/iommu/iova.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 47d1983dfa2a..580fdf669922 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -661,9 +661,6 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) unsigned long flags; int i; - if (!mag) - return; - spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); for (i = 0 ; i < mag->size; ++i) { @@ -683,12 +680,12 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) static bool iova_magazine_full(struct iova_magazine *mag) { - return (mag && mag->size == IOVA_MAG_SIZE); + return mag->size == IOVA_MAG_SIZE; } static bool iova_magazine_empty(struct iova_magazine *mag) { - return (!mag || mag->size == 0); + return mag->size == 0; } static unsigned long iova_magazine_pop(struct iova_magazine *mag, -- 2.35.3