]> www.infradead.org Git - users/hch/block.git/commitdiff
iommu/dma: fix iommu_dma_alloc_iova error handling
authorChristoph Hellwig <hch@lst.de>
Sat, 5 Oct 2024 09:38:04 +0000 (11:38 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 5 Oct 2024 16:14:56 +0000 (18:14 +0200)
__iommu_dma_alloc_iova return 0 on failure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/iommu/dma-iommu.c

index dee027833391b2b0390d4b83405006bec57a0b8c..9076b1b1d9c0abef34efaeeee71c5e4f28846271 100644 (file)
@@ -1756,7 +1756,7 @@ int iommu_dma_alloc_iova(struct dma_iova_state *state, phys_addr_t phys,
        size = iova_align(iovad, size + iova_offset(iovad, phys));
        addr = __iommu_dma_alloc_iova(domain, size, dma_get_mask(state->dev),
                                      state->dev);
-       if (addr == DMA_MAPPING_ERROR)
+       if (!addr)
                return -EINVAL;
 
        state->addr = addr;