Skip to contentSkip to conversation

ioport: Use kzalloc() instead of kmalloc()/memset() in _sparc_alloc_io()

PATCH New longlong yan 1 participant 1 message Jul 14 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioport: Use kzalloc() instead of kmalloc()/memset() in _sparc_alloc_io()

Replace kmalloc+memset by kzalloc for better readability and simplicity. This addresses the warning below:
WARNING: kzalloc should be used for data, instead of kmalloc/memset

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 arch/sparc/kernel/ioport.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/sparc/kernel/ioport.c +1 -2
index cbc0680a4642..df73439b290c 100644
@@ -184,9 +184,8 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
 			printed_full = 1;
 		}
 		tlen = strlen(name);
-		tack = kmalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL);
+		tack = kzalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL);
 		if (tack == NULL) return NULL;
-		memset(tack, 0, sizeof(struct resource));
 		res = (struct resource *) tack;
 		tack += sizeof (struct resource);
 	}
Signature · 1 line
2.43.0