[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aK60Py3r25U43k1E@infradead.org>
Date: Wed, 27 Aug 2025 00:31:11 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Baochen Qiang <baochen.qiang@....qualcomm.com>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Jeff Johnson <jjohnson@...nel.org>, iommu@...ts.linux.dev,
"linux-kernel@...r.kernel.org >> linux-kernel" <linux-kernel@...r.kernel.org>,
"ath11k@...ts.infradead.org" <ath11k@...ts.infradead.org>
Subject: Re: is dma_mapping_error() check necessary for
dma_alloc_noncoherent()?
On Tue, Aug 26, 2025 at 05:44:42PM +0800, Baochen Qiang wrote:
> Checking code gives me the impression that I should do dma_mapping_error() check as well.
> And indeed with below diff the warning is gone:
>
> + dma_mapping_error(ab->dev, paddr);
>
> However this does not make sense to me since IMO testing the CPU address is good enough, I
> can not imagine a valid case where DMA alloc/map fails while returning a valid CPU
> address, no?
Yes, this doesn't make sense. dma_mapping_error exists to provide a
error handling path for dma_map_*, which return the dma address only.
For the dma_alloc_* interfaces that return a pointer and can signal
with a NULL return it should not be needed and dma-debug needs to
be fixed.
> If I was right, should we remove invocation to debug_dma_map_page() in dma_alloc_pages()?
>
That allocation still needs to be tracked, so it can't just be removed
but needs to be changed to record the kind of allocation.
Powered by blists - more mailing lists