mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Jeff Johnson <jjohnson@kernel.org>,
	iommu@lists.linux.dev,
	"linux-kernel@vger.kernel.org >> linux-kernel"
	<linux-kernel@vger.kernel.org>,
	"ath11k@lists.infradead.org" <ath11k@lists.infradead.org>
Subject: Re: is dma_mapping_error() check necessary for dma_alloc_noncoherent()?
Date: Thu, 28 Aug 2025 14:32:11 +0800	[thread overview]
Message-ID: <ceee4a15-b31b-4c8c-9a8f-7093b85f99cf@oss.qualcomm.com> (raw)
In-Reply-To: <aK60Py3r25U43k1E@infradead.org>



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.


      reply	other threads:[~2025-08-28  6:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250826094453eucas1p178ff4a39db0c655f3505128a5cfb0a6a@eucas1p1.samsung.com>
2025-08-26  9:44 ` Baochen Qiang
2025-08-26 14:09   ` Marek Szyprowski
2025-08-27  1:55     ` Baochen Qiang
2025-08-27  7:31   ` Christoph Hellwig
2025-08-28  6:32     ` Baochen Qiang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ceee4a15-b31b-4c8c-9a8f-7093b85f99cf@oss.qualcomm.com \
    --to=baochen.qiang@oss.qualcomm.com \
    --cc=ath11k@lists.infradead.org \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=jjohnson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®