diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -1481,6 +1481,8 @@ sc = device_get_softc(dev); ctx = iommu_get_dev_ctx(child); + if (ctx == NULL) + return (ENXIO); error = iommu_map_msi(ctx, PAGE_SIZE, GITS_TRANSLATER, IOMMU_MAP_ENTRY_WRITE, IOMMU_MF_CANWAIT, &sc->ma); *domain = iommu_get_ctx_domain(ctx); @@ -1494,6 +1496,9 @@ struct iommu_ctx *ctx; ctx = iommu_get_dev_ctx(child); + if (ctx == NULL) + return; + iommu_unmap_msi(ctx); } #endif