From: John Garry Date: Wed, 7 Sep 2022 13:34:41 +0000 (+0800) Subject: iova: Remove iovad->rcaches check in iova_rcache_get() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=189cb8fec14acf4dee59eb2011519e86d389cd3e;p=linux.git iova: Remove iovad->rcaches check in iova_rcache_get() The iovad->rcaches check in iova_rcache_get() is pretty much useless without the same check in iova_rcache_insert(). Instead of adding this symmetric check to fastpath iova_rcache_insert(), drop the check in iova_rcache_get() in favour of making the IOVA domain rcache init more robust to failure in future. Signed-off-by: John Garry Reviewed-by: Robin Murphy Link: https://lore.kernel.org/r/1662557681-145906-4-git-send-email-john.garry@huawei.com Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 8aece052ce725..a44ad92fc5eb7 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -875,7 +875,7 @@ static unsigned long iova_rcache_get(struct iova_domain *iovad, { unsigned int log_size = order_base_2(size); - if (log_size >= IOVA_RANGE_CACHE_MAX_SIZE || !iovad->rcaches) + if (log_size >= IOVA_RANGE_CACHE_MAX_SIZE) return 0; return __iova_rcache_get(&iovad->rcaches[log_size], limit_pfn - size);