diff mbox series

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

Message ID f44be04317387f8936d31d5470963541615f30ef.1685283065.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit 61e2cd90681e91ee8202d22e5ca25b1100557fc4
Headers show
Series dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call | expand

Commit Message

Christophe JAILLET May 28, 2023, 2:11 p.m. UTC
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(-)

Comments

Dave Jiang May 30, 2023, 3:36 p.m. UTC | #1
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;
Fenghua Yu May 30, 2023, 3:51 p.m. UTC | #2
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
Bernd Petrovitsch May 30, 2023, 3:54 p.m. UTC | #3
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
Christophe JAILLET May 30, 2023, 6:46 p.m. UTC | #4
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
Vinod Koul July 11, 2023, 4:44 p.m. UTC | #5
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,
diff mbox series

Patch

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;