Skip to content

Commit a390bde

Browse files
John Garryjoergroedel
authored andcommitted
iova: Remove some magazine pointer NULL checks
Since commit 32e92d9 ("iommu/iova: Separate out rcache init") it has not been possible to have NULL CPU rcache "loaded" or "prev" magazine pointers once the IOVA domain has been properly initialized. Previously it was only possible to have NULL pointers from failure to allocate the magazines in the IOVA domain initialization. The only other two functions to modify these pointers - __iova_rcache_{get, insert}() - would already ensure that these pointers were non-NULL if initially non-NULL. As such, the mag NULL pointer checks in iova_magazine_full(), iova_magazine_empty(), and iova_magazine_free_pfns() may be dropped. Signed-off-by: John Garry <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent f2042ed commit a390bde

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/iommu/iova.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,6 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
661661
unsigned long flags;
662662
int i;
663663

664-
if (!mag)
665-
return;
666-
667664
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
668665

669666
for (i = 0 ; i < mag->size; ++i) {
@@ -683,12 +680,12 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
683680

684681
static bool iova_magazine_full(struct iova_magazine *mag)
685682
{
686-
return (mag && mag->size == IOVA_MAG_SIZE);
683+
return mag->size == IOVA_MAG_SIZE;
687684
}
688685

689686
static bool iova_magazine_empty(struct iova_magazine *mag)
690687
{
691-
return (!mag || mag->size == 0);
688+
return mag->size == 0;
692689
}
693690

694691
static unsigned long iova_magazine_pop(struct iova_magazine *mag,

0 commit comments

Comments
 (0)