From 06f9c24e55075e50ebc8b249a7853ad31bc1b3d1 Mon Sep 17 00:00:00 2001
From: Xiubo Li
Date: Thu, 9 Oct 2014 17:02:56 +0800
Subject: [PATCH] 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
---
drivers/base/regmap/regcache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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;
--
2.39.2