diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-09-17 03:56:32 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2016-09-26 13:36:17 -0400 |
commit | e349d4b7317818cbb21096ead26420c80819ddd4 (patch) | |
tree | 1765a3db30c651d5747bf5a81170619ae27b8730 | |
parent | 71660223f50036e67a2a66cf55815fa665639d3a (diff) |
ste_dma40: Replace four kzalloc() calls by kcalloc() in d40_hw_detect_init()
* The script "checkpatch.pl" can point information out like the following.
WARNING: Prefer kcalloc over kzalloc with multiply
Thus fix the affected source code places.
* Replace the specification of data types by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/ste_dma40.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 4a651b23e577..a426abd55dee 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -3283,19 +3283,20 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
3283 | base->gen_dmac.init_reg_size = ARRAY_SIZE(dma_init_reg_v4a); | 3283 | base->gen_dmac.init_reg_size = ARRAY_SIZE(dma_init_reg_v4a); |
3284 | } | 3284 | } |
3285 | 3285 | ||
3286 | base->phy_res = kzalloc(num_phy_chans * sizeof(struct d40_phy_res), | 3286 | base->phy_res = kcalloc(num_phy_chans, |
3287 | sizeof(*base->phy_res), | ||
3287 | GFP_KERNEL); | 3288 | GFP_KERNEL); |
3288 | if (!base->phy_res) | 3289 | if (!base->phy_res) |
3289 | goto failure; | 3290 | goto failure; |
3290 | 3291 | ||
3291 | base->lookup_phy_chans = kzalloc(num_phy_chans * | 3292 | base->lookup_phy_chans = kcalloc(num_phy_chans, |
3292 | sizeof(struct d40_chan *), | 3293 | sizeof(*base->lookup_phy_chans), |
3293 | GFP_KERNEL); | 3294 | GFP_KERNEL); |
3294 | if (!base->lookup_phy_chans) | 3295 | if (!base->lookup_phy_chans) |
3295 | goto failure; | 3296 | goto failure; |
3296 | 3297 | ||
3297 | base->lookup_log_chans = kzalloc(num_log_chans * | 3298 | base->lookup_log_chans = kcalloc(num_log_chans, |
3298 | sizeof(struct d40_chan *), | 3299 | sizeof(*base->lookup_log_chans), |
3299 | GFP_KERNEL); | 3300 | GFP_KERNEL); |
3300 | if (!base->lookup_log_chans) | 3301 | if (!base->lookup_log_chans) |
3301 | goto failure; | 3302 | goto failure; |
@@ -3306,9 +3307,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
3306 | if (!base->reg_val_backup_chan) | 3307 | if (!base->reg_val_backup_chan) |
3307 | goto failure; | 3308 | goto failure; |
3308 | 3309 | ||
3309 | base->lcla_pool.alloc_map = | 3310 | base->lcla_pool.alloc_map = kcalloc(num_phy_chans |
3310 | kzalloc(num_phy_chans * sizeof(struct d40_desc *) | 3311 | * D40_LCLA_LINK_PER_EVENT_GRP, |
3311 | * D40_LCLA_LINK_PER_EVENT_GRP, GFP_KERNEL); | 3312 | sizeof(*base->lcla_pool.alloc_map), |
3313 | GFP_KERNEL); | ||
3312 | if (!base->lcla_pool.alloc_map) | 3314 | if (!base->lcla_pool.alloc_map) |
3313 | goto failure; | 3315 | goto failure; |
3314 | 3316 | ||