From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: Use and error-check DMA_ERROR_CODE
Date: Wed, 1 Oct 2014 14:52:48 +0100 [thread overview]
Message-ID: <20141001135248.GQ5182@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20141001101323.GB2587@arm.com>
On Wed, Oct 01, 2014 at 11:13:23AM +0100, Will Deacon wrote:
> Hi Sean,
>
> On Tue, Sep 30, 2014 at 09:15:21PM +0100, Sean Paul wrote:
> > +
> > + if (dma_handle != DMA_ERROR_CODE)
> > + __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
>
> Is it legal to try and free a DMA buffer after a failed allocation? If so, I
> think we need something similar for arch/arm/.
No.
void
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_handle)
Free a region of consistent memory you previously allocated. dev,
^^^^^^^^^^^^^^^^^^^^^
This implies that the allocation was successful.
size and dma_handle must all be the same as those passed into
dma_alloc_coherent(). cpu_addr must be the virtual address returned by
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you want this behaviour, the proper way to do it would be to check
for a NULL cpu_addr, just like kfree() etc.
the dma_alloc_coherent().
--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2014-10-01 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-30 20:15 [PATCH] arm64: Use and error-check DMA_ERROR_CODE Sean Paul
2014-10-01 10:13 ` Will Deacon
2014-10-01 10:56 ` Catalin Marinas
2014-10-01 13:52 ` Russell King - ARM Linux [this message]
2014-10-01 15:31 ` [PATCH v2] arm64: Use DMA_ERROR_CODE to denote failed allocation Sean Paul
2014-10-02 10:57 ` Catalin Marinas
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=20141001135248.GQ5182@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).