From: John Garry <john.garry@huawei.com>
To: <robin.murphy@arm.com>, <joro@8bytes.org>, <will@kernel.org>
Cc: <iommu@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks
Date: Mon, 5 Sep 2022 17:11:22 +0800 [thread overview]
Message-ID: <1662369083-238529-2-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1662369083-238529-1-git-send-email-john.garry@huawei.com>
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 <john.garry@huawei.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
---
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
next prev parent reply other threads:[~2022-09-05 9:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 9:11 [PATCH v2 0/2] iova: Some misc changes John Garry
2022-09-05 9:11 ` John Garry [this message]
2022-09-05 15:06 ` [PATCH v2 1/2] iova: Remove some magazine pointer NULL checks Jerry Snitselaar
2022-09-06 9:28 ` Ethan Zhao
2022-09-06 10:50 ` John Garry
2022-09-06 13:37 ` Robin Murphy
2022-09-06 17:36 ` John Garry
2022-09-06 18:25 ` Robin Murphy
2022-09-07 8:46 ` John Garry
2022-09-07 9:05 ` Robin Murphy
2022-09-07 9:58 ` Ethan Zhao
2022-09-07 10:10 ` John Garry
2022-09-07 9:33 ` Ethan Zhao
2022-09-07 9:53 ` John Garry
2022-09-05 9:11 ` [PATCH v2 2/2] iova: Remove magazine BUG_ON() checks John Garry
2022-09-05 15:06 ` Jerry Snitselaar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1662369083-238529-2-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox