Skip to contentSkip to conversation

arch/sparc: Use kzalloc_node

PATCH Applied Sabyasachi Gupta 2 participants 4 messages Nov 3, 2018 – Nov 19, 2018 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/sparc: Use kzalloc_node

Replaced kmalloc_node + memset with kzalloc_node

---
 arch/sparc/kernel/iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/sparc/kernel/iommu.c +1 -2
index 40d008b..05eb016 100644
@@ -108,10 +108,9 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
 	/* Allocate and initialize the free area map.  */
 	sz = num_tsb_entries / 8;
 	sz = (sz + 7UL) & ~7UL;
-	iommu->tbl.map = kmalloc_node(sz, GFP_KERNEL, numa_node);
+	iommu->tbl.map = kzalloc_node(sz, GFP_KERNEL, numa_node);
 	if (!iommu->tbl.map)
 		return -ENOMEM;
-	memset(iommu->tbl.map, 0, sz);
 
 	iommu_tbl_pool_init(&iommu->tbl, num_tsb_entries, IO_PAGE_SHIFT,
 			    (tlb_type != hypervisor ? iommu_flushall : NULL),
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Sabyasachi Gupta

Replaced kmalloc_node + memset with kzalloc_node

Any comment on this patch?

Quoted 23 lines
---
 arch/sparc/kernel/iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/sparc/kernel/iommu.c +1 -3
index 40d008b..05eb016 100644
@@ -108,10 +108,9 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
        /* Allocate and initialize the free area map.  */
        sz = num_tsb_entries / 8;
        sz = (sz + 7UL) & ~7UL;
-       iommu->tbl.map = kmalloc_node(sz, GFP_KERNEL, numa_node);
+       iommu->tbl.map = kzalloc_node(sz, GFP_KERNEL, numa_node);
        if (!iommu->tbl.map)
                return -ENOMEM;
-       memset(iommu->tbl.map, 0, sz);
 
        iommu_tbl_pool_init(&iommu->tbl, num_tsb_entries, IO_PAGE_SHIFT,
                            (tlb_type != hypervisor ? iommu_flushall : NULL),
--

2.7.4

maintainer
#2 lore raw

From: Sabyasachi Gupta <[email protected]>
Date: Thu, 15 Nov 2018 23:23:42 +0530

Quoted 8 lines
Quoted 4 lines · Sabyasachi Gupta

Replaced kmalloc_node + memset with kzalloc_node

Any comment on this patch?

Just too busy to get to it and am at plumbers this week.

Will try to look at it next week.