diff options
| author | lixiubo <lixiubo@cmss.chinamobile.com> | 2015-11-20 05:06:29 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2015-11-20 07:27:57 -0500 |
| commit | eeda1bd69d5d8a020ce191f717b94ca99707daad (patch) | |
| tree | eb769d18e526981fcd22ac8c834b401e0eb4c376 /drivers/base/regmap | |
| parent | 8005c49d9aea74d382f474ce11afbbc7d7130bec (diff) | |
regmap: replace kzalloc with kcalloc
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>
Diffstat (limited to 'drivers/base/regmap')
| -rw-r--r-- | drivers/base/regmap/regcache-flat.c | 2 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-lzo.c | 2 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 5 | ||||
| -rw-r--r-- | drivers/base/regmap/regmap-irq.c | 8 |
4 files changed, 9 insertions, 8 deletions
diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c index 0246f44ded74..686c9e0b930e 100644 --- a/drivers/base/regmap/regcache-flat.c +++ b/drivers/base/regmap/regcache-flat.c | |||
| @@ -21,7 +21,7 @@ static int regcache_flat_init(struct regmap *map) | |||
| 21 | int i; | 21 | int i; |
| 22 | unsigned int *cache; | 22 | unsigned int *cache; |
| 23 | 23 | ||
| 24 | map->cache = kzalloc(sizeof(unsigned int) * (map->max_register + 1), | 24 | map->cache = kcalloc(map->max_register + 1, sizeof(unsigned int), |
| 25 | GFP_KERNEL); | 25 | GFP_KERNEL); |
| 26 | if (!map->cache) | 26 | if (!map->cache) |
| 27 | return -ENOMEM; | 27 | return -ENOMEM; |
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c index 736e0d378567..52f69381c070 100644 --- a/drivers/base/regmap/regcache-lzo.c +++ b/drivers/base/regmap/regcache-lzo.c | |||
| @@ -139,7 +139,7 @@ static int regcache_lzo_init(struct regmap *map) | |||
| 139 | ret = 0; | 139 | ret = 0; |
| 140 | 140 | ||
| 141 | blkcount = regcache_lzo_block_count(map); | 141 | blkcount = regcache_lzo_block_count(map); |
| 142 | map->cache = kzalloc(blkcount * sizeof *lzo_blocks, | 142 | map->cache = kcalloc(blkcount, sizeof(*lzo_blocks), |
| 143 | GFP_KERNEL); | 143 | GFP_KERNEL); |
| 144 | if (!map->cache) | 144 | if (!map->cache) |
| 145 | return -ENOMEM; | 145 | return -ENOMEM; |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 56486d92c4e7..3b6cfede2fd9 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
| @@ -366,8 +366,9 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) | |||
| 366 | if (!rbnode->block) | 366 | if (!rbnode->block) |
| 367 | goto err_free; | 367 | goto err_free; |
| 368 | 368 | ||
| 369 | rbnode->cache_present = kzalloc(BITS_TO_LONGS(rbnode->blklen) * | 369 | rbnode->cache_present = kcalloc(BITS_TO_LONGS(rbnode->blklen), |
| 370 | sizeof(*rbnode->cache_present), GFP_KERNEL); | 370 | sizeof(*rbnode->cache_present), |
| 371 | GFP_KERNEL); | ||
| 371 | if (!rbnode->cache_present) | 372 | if (!rbnode->cache_present) |
| 372 | goto err_free_block; | 373 | goto err_free_block; |
| 373 | 374 | ||
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 8d16db533527..4ebbe21ded82 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c | |||
| @@ -386,23 +386,23 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
| 386 | if (!d) | 386 | if (!d) |
| 387 | return -ENOMEM; | 387 | return -ENOMEM; |
| 388 | 388 | ||
| 389 | d->status_buf = kzalloc(sizeof(unsigned int) * chip->num_regs, | 389 | d->status_buf = kcalloc(chip->num_regs, sizeof(unsigned int), |
| 390 | GFP_KERNEL); | 390 | GFP_KERNEL); |
| 391 | if (!d->status_buf) | 391 | if (!d->status_buf) |
| 392 | goto err_alloc; | 392 | goto err_alloc; |
| 393 | 393 | ||
| 394 | d->mask_buf = kzalloc(sizeof(unsigned int) * chip->num_regs, | 394 | d->mask_buf = kcalloc(chip->num_regs, sizeof(unsigned int), |
| 395 | GFP_KERNEL); | 395 | GFP_KERNEL); |
| 396 | if (!d->mask_buf) | 396 | if (!d->mask_buf) |
| 397 | goto err_alloc; | 397 | goto err_alloc; |
| 398 | 398 | ||
| 399 | d->mask_buf_def = kzalloc(sizeof(unsigned int) * chip->num_regs, | 399 | d->mask_buf_def = kcalloc(chip->num_regs, sizeof(unsigned int), |
| 400 | GFP_KERNEL); | 400 | GFP_KERNEL); |
| 401 | if (!d->mask_buf_def) | 401 | if (!d->mask_buf_def) |
| 402 | goto err_alloc; | 402 | goto err_alloc; |
| 403 | 403 | ||
| 404 | if (chip->wake_base) { | 404 | if (chip->wake_base) { |
| 405 | d->wake_buf = kzalloc(sizeof(unsigned int) * chip->num_regs, | 405 | d->wake_buf = kcalloc(chip->num_regs, sizeof(unsigned int), |
| 406 | GFP_KERNEL); | 406 | GFP_KERNEL); |
| 407 | if (!d->wake_buf) | 407 | if (!d->wake_buf) |
| 408 | goto err_alloc; | 408 | goto err_alloc; |
