2023-05-28 14:23:13

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call

dma_alloc_coherent() already clear the allocated memory, there is no need
to explicitly call memset().

Signed-off-by: Christophe JAILLET <[email protected]>
---
drivers/dma/idxd/device.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 5abbcc61c528..7c74bc60f582 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd)
goto err_alloc;
}

- memset(addr, 0, size);
-
spin_lock(&evl->lock);
evl->log = addr;
evl->dma = dma_addr;
--
2.34.1



2023-05-30 15:51:26

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call


On 5/28/23 07:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
>
> Signed-off-by: Christophe JAILLET <[email protected]>
Acked-by: Dave Jiang <[email protected]>
> ---
> drivers/dma/idxd/device.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 5abbcc61c528..7c74bc60f582 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd)
> goto err_alloc;
> }
>
> - memset(addr, 0, size);
> -
> spin_lock(&evl->lock);
> evl->log = addr;
> evl->dma = dma_addr;

2023-05-30 16:02:10

by Fenghua Yu

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call



On 5/28/23 07:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
>
> Signed-off-by: Christophe JAILLET <[email protected]>

Acked-by: Fenghua Yu <[email protected]>

Thanks.

-Fenghua

2023-05-30 18:45:18

by Bernd Petrovitsch

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call

On 28/05/2023 16:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().

Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function?

Kind regards,
Bernd
--
Bernd Petrovitsch Email : [email protected]
There is NO CLOUD, just other people's computers. - FSFE
LUGA : http://www.luga.at


2023-05-30 19:07:59

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call

Le 30/05/2023 à 17:54, Bernd Petrovitsch a écrit :
> On 28/05/2023 16:11, Christophe JAILLET wrote:
>> dma_alloc_coherent() already clear the allocated memory, there is no need
>> to explicitly call memset().
>
> Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function?
>
> Kind regards,
>     Bernd

Hi,

No strong opinion about it.
It is not malloc either !)

When dma_zalloc_coherent() has been deprecated (see [1]), for some
reason, it was decided to keep the "alloc" version.

CJ


[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/dma-mapping.h?id=06d4dd2f2ce1cdb625f77c0676d5af6ba310c01d

2023-07-11 17:03:14

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call


On Sun, 28 May 2023 16:11:54 +0200, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
>
>

Applied, thanks!

[1/1] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
commit: 61e2cd90681e91ee8202d22e5ca25b1100557fc4

Best regards,
--
~Vinod