Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2864519rwb; Mon, 5 Sep 2022 02:48:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bMatv50ww5o35k8Vkj8QNocmvQFWfKW1RlFDHHtmP1r+Ms5OaHPyYEag2kaBlH+jQO1GK X-Received: by 2002:a17:90a:4d8a:b0:200:183a:10ad with SMTP id m10-20020a17090a4d8a00b00200183a10admr11368949pjh.171.1662371308469; Mon, 05 Sep 2022 02:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662371308; cv=none; d=google.com; s=arc-20160816; b=pQ3y8kxcmz+Ecw6hFOtJQJjuikDtTeDh3xGLmkCt1lcB0ql5lF9JYYMcfDp6c8IAx3 y0NrTUdQ4DBUbKpmo9qCAPnYJSHS2xIiv5R/jsyfRQRWDwNB0HwOrw/yDnRqHwsA9D1K JxoifZ5k0zDEq48i+jPD4etzmdv/X/hJ8TR9XndCjYtwg9ziV1rzXYMK/rOBKy9zxd7W CiEIjVyf4beZKzZ3Hi8qIcFVjE9jdId8XKFdBihDWrGUUgRLDrvz2sI1zUH7lbLbGDA3 oayOSFcaeYGg8+lkR479Zo7s3Z9H99xGROlcNT91UWoeRRrvaEGCNt6ZaovMnlDTo3TV 3m2Q== 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=m63phDZ/+o1ZXmBxrCUAonLNIN+HDpObk7RI/k8mVl8=; b=rLQltM0kR5GBOhnvBriiQ9PC3cvhW9egqJ+k4jzOcw1VEBRw4BQHI7nFw9fBGiBLyj Y5Fn/x4AmXXowz0lZfUnsXkf0tDfPS4Nw8RS/o14f4vKnCGzGsbW6jCRl7V3z9FlF2cH edx07JO9zhCil6cfA2pmqZVNgaZgoW/+a5Mui83vwtOPiiHw4j5M7VN+6l/wyyhJYINN l0iMKsJUGi6KfN5jTS7UdH7JLHfiQv0xWFjKF3vB45cvUggbbzdDWn9qj9GJStqMPgXl NS4h7OPFfht26K3uwwdIKoOwvV86XjA8XTxL/au1x7x0ZnkTAFxXHdmumkGUnXwyUDzc GKhQ== 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 a192-20020a6390c9000000b0043452f565d1si3382743pge.124.2022.09.05.02.48.17; Mon, 05 Sep 2022 02:48:28 -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 S236870AbiIEJR4 (ORCPT + 99 others); Mon, 5 Sep 2022 05:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236681AbiIEJRy (ORCPT ); Mon, 5 Sep 2022 05:17:54 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BCC3C8DB for ; Mon, 5 Sep 2022 02:17:53 -0700 (PDT) Received: from fraeml709-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MLjZv0Pn1z67xgN; Mon, 5 Sep 2022 17:17:11 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml709-chm.china.huawei.com (10.206.15.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 5 Sep 2022 11:17:51 +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.31; Mon, 5 Sep 2022 10:17:49 +0100 From: John Garry To: , , CC: , , , John Garry Subject: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks Date: Mon, 5 Sep 2022 17:11:22 +0800 Message-ID: <1662369083-238529-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662369083-238529-1-git-send-email-john.garry@huawei.com> References: <1662369083-238529-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 Reviewed-by: Robin Murphy --- 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