diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-03-12 09:53:32 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-03-18 08:08:08 -0400 |
commit | 0206caa81cb7b416d7c19d56f83a89ecbe33f536 (patch) | |
tree | f4bbf9341dc821f6e84ccb464bc900eaffe582eb | |
parent | 0dae530ccf0edda8a0d289c118e7e1609b198af0 (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.c | 17 |
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) | |||
1076 | pctl->ngroups = pctl->devdata->npins; | 1076 | pctl->ngroups = pctl->devdata->npins; |
1077 | 1077 | ||
1078 | /* Allocate groups */ | 1078 | /* Allocate groups */ |
1079 | pctl->groups = devm_kzalloc(&pdev->dev, | 1079 | pctl->groups = devm_kcalloc(&pdev->dev, pctl->ngroups, |
1080 | pctl->ngroups * sizeof(*pctl->groups), | 1080 | sizeof(*pctl->groups), GFP_KERNEL); |
1081 | GFP_KERNEL); | ||
1082 | if (!pctl->groups) | 1081 | if (!pctl->groups) |
1083 | return -ENOMEM; | 1082 | return -ENOMEM; |
1084 | 1083 | ||
1085 | /* We assume that one pin is one group, use pin name as group name. */ | 1084 | /* We assume that one pin is one group, use pin name as group name. */ |
1086 | pctl->grp_names = devm_kzalloc(&pdev->dev, | 1085 | pctl->grp_names = devm_kcalloc(&pdev->dev, pctl->ngroups, |
1087 | pctl->ngroups * sizeof(*pctl->grp_names), | 1086 | sizeof(*pctl->grp_names), GFP_KERNEL); |
1088 | GFP_KERNEL); | ||
1089 | if (!pctl->grp_names) | 1087 | if (!pctl->grp_names) |
1090 | return -ENOMEM; | 1088 | return -ENOMEM; |
1091 | 1089 | ||
@@ -1152,8 +1150,7 @@ int mtk_pctrl_init(struct platform_device *pdev, | |||
1152 | return -EINVAL; | 1150 | return -EINVAL; |
1153 | } | 1151 | } |
1154 | 1152 | ||
1155 | pins = devm_kzalloc(&pdev->dev, | 1153 | pins = devm_kcalloc(&pdev->dev, pctl->devdata->npins, sizeof(*pins), |
1156 | pctl->devdata->npins * sizeof(*pins), | ||
1157 | GFP_KERNEL); | 1154 | GFP_KERNEL); |
1158 | if (!pins) | 1155 | if (!pins) |
1159 | return -ENOMEM; | 1156 | return -ENOMEM; |
@@ -1211,8 +1208,8 @@ int mtk_pctrl_init(struct platform_device *pdev, | |||
1211 | goto chip_error; | 1208 | goto chip_error; |
1212 | } | 1209 | } |
1213 | 1210 | ||
1214 | pctl->eint_dual_edges = devm_kzalloc(&pdev->dev, | 1211 | pctl->eint_dual_edges = devm_kcalloc(&pdev->dev, pctl->devdata->ap_num, |
1215 | sizeof(int) * pctl->devdata->ap_num, GFP_KERNEL); | 1212 | sizeof(int), GFP_KERNEL); |
1216 | if (!pctl->eint_dual_edges) { | 1213 | if (!pctl->eint_dual_edges) { |
1217 | ret = -ENOMEM; | 1214 | ret = -ENOMEM; |
1218 | goto chip_error; | 1215 | goto chip_error; |