summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-03-12 21:53:32 +0800
committerLinus Walleij <linus.walleij@linaro.org>2015-03-18 13:08:08 +0100
commit0206caa81cb7b416d7c19d56f83a89ecbe33f536 (patch)
treef4bbf9341dc821f6e84ccb464bc900eaffe582eb
parent0dae530ccf0edda8a0d289c118e7e1609b198af0 (diff)
pinctrl: mediatek: mtk-common: Use devm_kcalloc at appropriate places
Prefer devm_kcalloc over devm_kzalloc with multiply. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index f82f57a4c354..493294c0ebe6 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1076,16 +1076,14 @@ static int mtk_pctrl_build_state(struct platform_device *pdev)
pctl->ngroups = pctl->devdata->npins;
/* Allocate groups */
- pctl->groups = devm_kzalloc(&pdev->dev,
- pctl->ngroups * sizeof(*pctl->groups),
- GFP_KERNEL);
+ pctl->groups = devm_kcalloc(&pdev->dev, pctl->ngroups,
+ sizeof(*pctl->groups), GFP_KERNEL);
if (!pctl->groups)
return -ENOMEM;
/* We assume that one pin is one group, use pin name as group name. */
- pctl->grp_names = devm_kzalloc(&pdev->dev,
- pctl->ngroups * sizeof(*pctl->grp_names),
- GFP_KERNEL);
+ pctl->grp_names = devm_kcalloc(&pdev->dev, pctl->ngroups,
+ sizeof(*pctl->grp_names), GFP_KERNEL);
if (!pctl->grp_names)
return -ENOMEM;
@@ -1152,8 +1150,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
return -EINVAL;
}
- pins = devm_kzalloc(&pdev->dev,
- pctl->devdata->npins * sizeof(*pins),
+ pins = devm_kcalloc(&pdev->dev, pctl->devdata->npins, sizeof(*pins),
GFP_KERNEL);
if (!pins)
return -ENOMEM;
@@ -1211,8 +1208,8 @@ int mtk_pctrl_init(struct platform_device *pdev,
goto chip_error;
}
- pctl->eint_dual_edges = devm_kzalloc(&pdev->dev,
- sizeof(int) * pctl->devdata->ap_num, GFP_KERNEL);
+ pctl->eint_dual_edges = devm_kcalloc(&pdev->dev, pctl->devdata->ap_num,
+ sizeof(int), GFP_KERNEL);
if (!pctl->eint_dual_edges) {
ret = -ENOMEM;
goto chip_error;