linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] arm64: Check for NULL device before getting the coherent_dma_mask
Date: Mon,  9 Dec 2013 16:12:12 -0800	[thread overview]
Message-ID: <1386634334-31139-2-git-send-email-lauraa@codeaurora.org> (raw)
In-Reply-To: <1386634334-31139-1-git-send-email-lauraa@codeaurora.org>

The device passed in to dma_alloc may be NULL. Check for this before
trying to get the coherent_dma_mask.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
---
 arch/arm64/mm/dma-mapping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4bd7579..4134212 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -33,7 +33,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
 					  dma_addr_t *dma_handle, gfp_t flags,
 					  struct dma_attrs *attrs)
 {
-	if (IS_ENABLED(CONFIG_ZONE_DMA32) &&
+	if (dev && IS_ENABLED(CONFIG_ZONE_DMA32) &&
 	    dev->coherent_dma_mask <= DMA_BIT_MASK(32))
 		flags |= GFP_DMA32;
 	return swiotlb_alloc_coherent(dev, size, dma_handle, flags);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-12-10  0:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10  0:12 [PATCH 0/3] CMA support for arm64 Laura Abbott
2013-12-10  0:12 ` Laura Abbott [this message]
2013-12-10  0:12 ` [PATCH 2/3] arm64: Enable CMA Laura Abbott
2013-12-10  0:12 ` [PATCH 3/3] swiotlb: Add support for CMA allocations Laura Abbott
2013-12-10  0:29   ` Konrad Rzeszutek Wilk
2013-12-10  0:36     ` Laura Abbott
2013-12-10  0:40       ` Konrad Rzeszutek Wilk
2013-12-10 10:25         ` Will Deacon
2013-12-10 10:42           ` Catalin Marinas
2013-12-10 13:50             ` Will Deacon
2013-12-10 13:56               ` Konrad Rzeszutek Wilk
2013-12-10 14:50               ` Catalin Marinas
2013-12-10 19:03                 ` Laura Abbott
2013-12-13  0:48             ` Laura Abbott
2013-12-13 13:37               ` Catalin Marinas
2013-12-13 13:45                 ` Will Deacon

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=1386634334-31139-2-git-send-email-lauraa@codeaurora.org \
    --to=lauraa@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).