> @@ -1982,6 +1982,9 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd, > if (!pd->device->ops.alloc_mr) > return ERR_PTR(-EOPNOTSUPP); > > + if (WARN_ON_ONCE(mr_type == IB_MR_TYPE_PI)) > + return ERR_PTR(-EINVAL); > + So why is IB_MR_TYPE_PI a separate function, but IB_MR_TYPE_SG_GAPS is not? I think we either want one alloc/free helper per type, or we have to extend ib_alloc_mr with an arguments structure or something similar.