]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
regmap: cache: use kmalloc_array instead of kmalloc
authorXiubo Li <Li.Xiubo@freescale.com>
Thu, 9 Oct 2014 09:02:56 +0000 (17:02 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 20 Oct 2014 11:25:02 +0000 (12:25 +0100)
This patch fixes checkpatch.pl warning for regmap cache.
WARNING : prefer kmalloc_array over kmalloc with multiply

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache.c

index 0852c890b4b5992093096922df7430f5ade19adb..726d956f6a298ae3500c55f207fc3594a7daf211 100644 (file)
@@ -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;