Skip to contentSkip to conversation

drivers: base: map: Use kmalloc_array instead of kmalloc

PATCH New Andrei Poenaru 1 participant 1 message Mar 8, 2015 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: base: map: Use kmalloc_array instead of kmalloc

Reported by checkpatch.pl

While at it, removed blank line between function call and error checking.

---
 drivers/base/map.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/base/map.c +1 -2
index e87017f..c1d3823 100644
@@ -41,8 +41,7 @@ int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
 	if (n > 255)
 		n = 255;
 
-	p = kmalloc(sizeof(struct probe) * n, GFP_KERNEL);
-
+	p = kmalloc_array(n, sizeof(struct probe), GFP_KERNEL);
 	if (p == NULL)
 		return -ENOMEM;
 
Signature · 1 line
1.9.1