scsi: dma-mapping: Make dma_max_mapping_size() return 0 for no DMA capability

For when a device is not DMA capable, the max mapping size would be 0, so
make dma_max_mapping_size() reflect that.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260629085310.2298552-2-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
John Garry 2026-06-29 08:53:09 +00:00 committed by Martin K. Petersen
parent 98575b9ffc
commit 81d273096f

View File

@ -979,6 +979,9 @@ size_t dma_max_mapping_size(struct device *dev)
const struct dma_map_ops *ops = get_dma_ops(dev);
size_t size = SIZE_MAX;
if (!dev->dma_mask)
return 0;
if (dma_map_direct(dev, ops))
size = dma_direct_max_mapping_size(dev);
else if (use_dma_iommu(dev))