[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ceee4a15-b31b-4c8c-9a8f-7093b85f99cf@oss.qualcomm.com>
Date: Thu, 28 Aug 2025 14:32:11 +0800
From: Baochen Qiang <baochen.qiang@....qualcomm.com>
To: Christoph Hellwig <hch@...radead.org>
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 8/27/2025 3:31 PM, Christoph Hellwig wrote:
> 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.
Thanks, I will submit a patch to fix this.
Powered by blists - more mailing lists