git: e6775534aee1 - main - iommu_gas: Correct a broken KASSERT

From: Alan Cox <alc_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 18:06:01 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6775534aee1963a39e5ee762b8eab1d7dfb1b6b

commit e6775534aee1963a39e5ee762b8eab1d7dfb1b6b
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2022-06-17 17:03:06 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2022-06-17 18:05:20 +0000

    iommu_gas: Correct a broken KASSERT
    
    If iommu_gas_find_space() ever called iommu_gas_uppermatch(), and it
    succeeded in allocating space, then the subsequent KASSERT would be
    triggered.  Change that KASSERT to accept either success or ENOMEM.
    
    MFC after:      1 week
---
 sys/dev/iommu/iommu_gas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index a65bb23e87c5..073b5626edf6 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -504,7 +504,7 @@ iommu_gas_find_space(struct iommu_domain *domain,
 	if (common->highaddr >= domain->end)
 		return (ENOMEM);
 	error = iommu_gas_uppermatch(&a, RB_ROOT(&domain->rb_root));
-	KASSERT(error == ENOMEM,
+	KASSERT(error == 0 || error == ENOMEM,
 	    ("error %d from iommu_gas_uppermatch", error));
 	return (error);
 }