From: Xiubo Li
Date: Thu, 9 Oct 2014 09:02:56 +0000 (+0800)
Subject: regmap: cache: use kmalloc_array instead of kmalloc
X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=06f9c24e55075e50ebc8b249a7853ad31bc1b3d1;p=linux-beck.git
regmap: cache: use kmalloc_array instead of kmalloc
This patch fixes checkpatch.pl warning for regmap cache.
WARNING : prefer kmalloc_array over kmalloc with multiply
Signed-off-by: Xiubo Li
Signed-off-by: Mark Brown
---
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 0852c890b4b5..726d956f6a29 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -61,8 +61,8 @@ static int regcache_hw_init(struct regmap *map)
if (!regmap_volatile(map, i * map->reg_stride))
count++;
- map->reg_defaults = kmalloc(count * sizeof(struct reg_default),
- GFP_KERNEL);
+ map->reg_defaults = kmalloc_array(count, sizeof(struct reg_default),
+ GFP_KERNEL);
if (!map->reg_defaults) {
ret = -ENOMEM;
goto err_free;