This patch fixes checkpatch.pl warning for regmap cache.
WARNING : prefer kmalloc_array over kmalloc with multiply

Signed-off-by: Xiubo Li <[email protected]>
---
 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 45ab909..a06bcd2 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.1.0.27.g96db324

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to