From: Alexander Duyck Date: Wed, 3 Oct 2018 23:48:07 +0000 (-0700) Subject: dma-direct: fix return value of dma_direct_supported X-Git-Tag: v5.15~7732^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fc8e6423edb4bba365b0780c2fcddfb921b24b2;p=platform%2Fkernel%2Flinux-starfive.git dma-direct: fix return value of dma_direct_supported It appears that in commit 9d7a224b463e ("dma-direct: always allow dma mask <= physiscal memory size") the logic of the test was changed from a "<" to a ">=" however I don't see any reason for that change. I am assuming that there was some additional change planned, specifically I suspect the logic was intended to be reversed and possibly used for a return. Since that is the case I have gone ahead and done that. This addresses issues I had on my system that prevented me from booting with the above mentioned commit applied on an x86_64 system w/ Intel IOMMU. Fixes: 9d7a224b463e ("dma-direct: always allow dma mask <= physiscal memory size") Signed-off-by: Alexander Duyck Acked-by: Robin Murphy Signed-off-by: Christoph Hellwig --- diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 170bd32..674a8da 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -301,9 +301,7 @@ int dma_direct_supported(struct device *dev, u64 mask) min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT); - if (mask >= phys_to_dma(dev, min_mask)) - return 0; - return 1; + return mask >= phys_to_dma(dev, min_mask); } int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)