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 |
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;
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
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
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
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 --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;
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(-)