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

Christophe JAILLET posted 1 patch 2 years, 8 months ago
There is a newer version of this series
drivers/dma/idxd/device.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Christophe JAILLET 2 years, 8 months ago
dma_alloc_coherent() already clear the allocated memory, there is no need
to explicitly call memset().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 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
Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Vinod Koul 2 years, 7 months ago
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
Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Bernd Petrovitsch 2 years, 8 months ago
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 : bernd@petrovitsch.priv.at
      There is NO CLOUD, just other people's computers. - FSFE
                      LUGA : http://www.luga.at
Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Christophe JAILLET 2 years, 8 months ago
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
Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Fenghua Yu 2 years, 8 months ago

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 <christophe.jaillet@wanadoo.fr>

Acked-by: Fenghua Yu <fenghua.yu@intel.com>

Thanks.

-Fenghua
Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
Posted by Dave Jiang 2 years, 8 months ago
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 <christophe.jaillet@wanadoo.fr>
Acked-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   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;