From: zhong jiang <zhongjiang@huawei.com>
To: dalias@libc.org, ysato@users.sourceforge.jp
Cc: robin.murphy@arm.com, thomas.petazzoni@free-electrons.com,
geert+renesas@glider.be, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset
Date: Mon, 10 Sep 2018 02:55:04 +0000 [thread overview]
Message-ID: <1536548104-57453-1-git-send-email-zhongjiang@huawei.com> (raw)
dma_zalloc_coherent has taken the dma_alloc_coherent() and memset() into
account. Therefore, just use dma_zalloc_coherent to replace the open code.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
arch/sh/mm/consistent.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 792f361..aa4e450 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -52,14 +52,12 @@ int __init platform_resource_setup_memory(struct platform_device *pdev,
if (!memsize)
return 0;
- buf = dma_alloc_coherent(&pdev->dev, memsize, &dma_handle, GFP_KERNEL);
+ buf = dma_zalloc_coherent(&pdev->dev, memsize, &dma_handle, GFP_KERNEL);
if (!buf) {
pr_warning("%s: unable to allocate memory\n", name);
return -ENOMEM;
}
- memset(buf, 0, memsize);
-
r->flags = IORESOURCE_MEM;
r->start = dma_handle;
r->end = r->start + memsize - 1;
--
1.7.12.4
next reply other threads:[~2018-09-10 2:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 2:55 zhong jiang [this message]
2018-09-10 10:02 ` [PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset Geert Uytterhoeven
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=1536548104-57453-1-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=dalias@libc.org \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=ysato@users.sourceforge.jp \
/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).