On Tue, Oct 06, 2020 at 10:53:45AM +0300, Leon Romanovsky wrote: > On Tue, Oct 06, 2020 at 08:35:54AM +0100, Christoph Hellwig wrote: > > > + 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. > > I expect to see this during driver development/testing. It is not worth > to make if() case id device won't be operable. Then you'll need an ifdef or whatever your preferred method is to avoid the dma_virt_ops symbol reference for the !CONFIG_DMA_VIRT_OPS case.