@@ -281,9 +281,8 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl)
for (df = pctl->ppins[i].functions; df->name; df++)
if (!pxa2xx_find_function(pctl, df->name, functions))
(functions + pctl->nfuncs++)->name = df->name;
- pctl->functions = devm_kmemdup(pctl->dev, functions,
- pctl->nfuncs * sizeof(*functions),
- GFP_KERNEL);
+ pctl->functions = devm_kmemdup_array(pctl->dev, functions, pctl->nfuncs,
+ sizeof(*functions), GFP_KERNEL);
if (!pctl->functions)
return -ENOMEM;
@@ -314,7 +313,8 @@ static int pxa2xx_build_groups(struct pxa_pinctrl *pctl)
pctl->ppins[j].pin.name;
func = pctl->functions + i;
func->ngroups = ngroups;
- func->groups = devm_kmemdup(pctl->dev, gtmp, ngroups * sizeof(*gtmp), GFP_KERNEL);
+ func->groups = devm_kmemdup_array(pctl->dev, gtmp, ngroups,
+ sizeof(*gtmp), GFP_KERNEL);
if (!func->groups)
return -ENOMEM;
}
Convert to use devm_kmemdup_array() which is more robust. Signed-off-by: Raag Jadav <raag.jadav@intel.com> --- drivers/pinctrl/pxa/pinctrl-pxa2xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)