> + WARN_ON(!IS_ENABLED(CONFIG_DMA_VIRT_OPS) && !dma_device); > + if (!dma_device) { > /* > - * The caller did not provide custom DMA operations. Use the > - * DMA mapping operations of the parent device. > + * If the caller does not provide a DMA capable device then the > + * IB device will be used. In this case the caller should fully > + * setup the ibdev for DMA. This usually means using > + * dma_virt_ops. > */ > + device->dev.dma_ops = &dma_virt_ops; > + dma_device = &device->dev; The lack of the if probably means this will fail to link now when CONFIG_DMA_VIRT_OPS is not set. This also seems to not remove the dma_virt_ops assignment in the callers. > index f904bb34477a..2f117ac11c8b 100644 > --- a/drivers/infiniband/sw/rdmavt/vt.c > +++ b/drivers/infiniband/sw/rdmavt/vt.c > @@ -581,7 +581,11 @@ int rvt_register_device(struct rvt_dev_info *rdi) > spin_lock_init(&rdi->n_cqs_lock); > > /* DMA Operations */ > - rdi->ibdev.dev.dma_ops = rdi->ibdev.dev.dma_ops ? : &dma_virt_ops; > + rdi->ibdev.dev.dma_ops = &dma_virt_ops; > + rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms; > + rdi->ibdev.dev.dma_mask = rdi->ibdev.dev.parent->dma_mask; This copies the dma_mask pointer, which seems completely bogus.