linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shashim@codeaurora.org (Shiraz Hashim)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] arm: dma-mapping: DMA buf may not have cpu virtual addr
Date: Thu, 22 Mar 2018 17:44:18 +0530	[thread overview]
Message-ID: <1521720858-9031-1-git-send-email-shashim@codeaurora.org> (raw)

DMA buffers may not have cpu virtual addresses when
allocated using DMA_ATTR_NO_KERNEL_MAPPING attribute.
Page address should therefore be looked up while
searching for such dma bufs.

Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
---
 arch/arm/mm/dma-mapping.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ada8eb2..c85fc0a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -883,9 +883,10 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
 		.page = page,
 		.want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0),
 	};
+	void *addr = (args.want_vaddr) ? cpu_addr : page;
 
-	buf = arm_dma_buffer_find(cpu_addr);
-	if (WARN(!buf, "Freeing invalid buffer %p\n", cpu_addr))
+	buf = arm_dma_buffer_find(addr);
+	if (WARN(!buf, "Freeing invalid buffer %p\n", addr))
 		return;
 
 	buf->allocator->free(&args);
-- 
Shiraz Hashim

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation

                 reply	other threads:[~2018-03-22 12:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1521720858-9031-1-git-send-email-shashim@codeaurora.org \
    --to=shashim@codeaurora.org \
    --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).