]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
regmap: replace kzalloc with kcalloc
authorlixiubo <lixiubo@cmss.chinamobile.com>
Fri, 20 Nov 2015 10:06:29 +0000 (18:06 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 20 Nov 2015 12:27:57 +0000 (12:27 +0000)
Replace kzalloc with specialized function kcalloc when the size is
a multiplication of : number * sizeof

Signed-off-by: lixiubo <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache-flat.c
drivers/base/regmap/regcache-lzo.c
drivers/base/regmap/regcache-rbtree.c
drivers/base/regmap/regmap-irq.c

index 0246f44ded747478f3dab0ba0441d4fdff2ae318..686c9e0b930eff7db5fb5ea01d8760cdf4d5901f 100644 (file)
@@ -21,7 +21,7 @@ static int regcache_flat_init(struct regmap *map)
        int i;
        unsigned int *cache;
 
-       map->cache = kzalloc(sizeof(unsigned int) * (map->max_register + 1),
+       map->cache = kcalloc(map->max_register + 1, sizeof(unsigned int),
                             GFP_KERNEL);
        if (!map->cache)
                return -ENOMEM;
index 736e0d378567c80900f2be8dd4d117b829e0242d..52f69381c0700a24c3253fdbb1dff89fe8e74a89 100644 (file)
@@ -139,7 +139,7 @@ static int regcache_lzo_init(struct regmap *map)
        ret = 0;
 
        blkcount = regcache_lzo_block_count(map);
-       map->cache = kzalloc(blkcount * sizeof *lzo_blocks,
+       map->cache = kcalloc(blkcount, sizeof(*lzo_blocks),
                             GFP_KERNEL);
        if (!map->cache)
                return -ENOMEM;
index 56486d92c4e72bd583630baea0fba541f36c926f..3b6cfede2fd9f0b2a5f69d5ed786a7100f6b23a0 100644 (file)
@@ -366,8 +366,9 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)
        if (!rbnode->block)
                goto err_free;
 
-       rbnode->cache_present = kzalloc(BITS_TO_LONGS(rbnode->blklen) *
-               sizeof(*rbnode->cache_present), GFP_KERNEL);
+       rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen),
+                                       sizeof(*rbnode->cache_present),
+                                       GFP_KERNEL);
        if (!rbnode->cache_present)
                goto err_free_block;
 
index 8d16db533527362efa638f67b69673607d069327..4ebbe21ded822e9c4261b0d069fbb4c5bc744ee6 100644 (file)
@@ -386,23 +386,23 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
        if (!d)
                return -ENOMEM;
 
-       d->status_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
+       d->status_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
                                GFP_KERNEL);
        if (!d->status_buf)
                goto err_alloc;
 
-       d->mask_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
+       d->mask_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
                              GFP_KERNEL);
        if (!d->mask_buf)
                goto err_alloc;
 
-       d->mask_buf_def = kzalloc(sizeof(unsigned int) * chip->num_regs,
+       d->mask_buf_def = kcalloc(chip->num_regs, sizeof(unsigned int),
                                  GFP_KERNEL);
        if (!d->mask_buf_def)
                goto err_alloc;
 
        if (chip->wake_base) {
-               d->wake_buf = kzalloc(sizeof(unsigned int) * chip->num_regs,
+               d->wake_buf = kcalloc(chip->num_regs, sizeof(unsigned int),
                                      GFP_KERNEL);
                if (!d->wake_buf)
                        goto err_alloc;