Skip to contentSkip to conversation

dma: device: Remove redundant code

PATCH In review [email protected] 2 participants 3 messages Aug 13, 2023 – Aug 28, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma: device: Remove redundant code

From: Rajeshwar R Shinde <[email protected]>

dma_alloc_coherent function already zeroes the array 'addr'. So, memset function call is not needed.

This fixes warning such as:
drivers/dma/idxd/device.c:783:8-26:
WARNING: dma_alloc_coherent used in addr already zeroes out memory, so memset is not needed.

---
 drivers/dma/idxd/device.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/idxd/device.c +0 -2
index 5abbcc61c528..7c74bc60f582 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

Remainder

Quoted 29 lines · On Sun, 13 Aug, 2023, 6:52 pm , <[email protected]> wrote:

From: Rajeshwar R Shinde <[email protected]>

dma_alloc_coherent function already zeroes the array 'addr'. So, memset function call is not needed.

This fixes warning such as:
drivers/dma/idxd/device.c:783:8-26:
WARNING: dma_alloc_coherent used in addr already zeroes out memory, so memset is not needed.

---
 drivers/dma/idxd/device.c | 2 --
 1 file changed, 2 deletions(-)
drivers/dma/idxd/device.c +0 -2
index 5abbcc61c528..7c74bc60f582 100644
@@ -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;
Quoted 4 lines

--
2.25.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 11 lines · On 8/13/23 06:22, [email protected] wrote:

From: Rajeshwar R Shinde <[email protected]>

dma_alloc_coherent function already zeroes the array 'addr'. So, memset function call is not needed.

This fixes warning such as:
drivers/dma/idxd/device.c:783:8-26:
WARNING: dma_alloc_coherent used in addr already zeroes out memory, so memset is not needed.

Please rename subject line to:

dmaengine: idxd: Remove redundant memset() for eventlog allocation

With the change,

Quoted 9 lines
---
  drivers/dma/idxd/device.c | 2 --
  1 file changed, 2 deletions(-)
drivers/dma/idxd/device.c +0 -0
index 5abbcc61c528..7c74bc60f582 100644

drivers/dma/idxd/device.c static int idxd_device_evl_setup(struct idxd_device *idxd) · line 791

Quoted 8 lines
drivers/dma/idxd/device.c +0 -2
@@ -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;

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees