Re: [PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-10 Thread Geert Uytterhoeven
On Mon, Sep 10, 2018 at 5:07 AM zhong jiang  wrote:
> 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 

Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-10 Thread Geert Uytterhoeven
On Mon, Sep 10, 2018 at 5:07 AM zhong jiang  wrote:
> 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 

Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-09 Thread zhong jiang
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 
---
 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(>dev, memsize, _handle, GFP_KERNEL);
+   buf = dma_zalloc_coherent(>dev, memsize, _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



[PATCH] sh: mm: Use dma_zalloc_coherent instead of dma_alloc_coherent + memset

2018-09-09 Thread zhong jiang
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 
---
 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(>dev, memsize, _handle, GFP_KERNEL);
+   buf = dma_zalloc_coherent(>dev, memsize, _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