Skip to content

Commit 86068ac

Browse files
raagjadavandy-shev
authored andcommitted
pinctrl: pxa2xx: use devm_kmemdup_array()
Convert to use devm_kmemdup_array() which is more robust. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 91bfcc7 commit 86068ac

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/pinctrl/pxa/pinctrl-pxa2xx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl)
281281
for (df = pctl->ppins[i].functions; df->name; df++)
282282
if (!pxa2xx_find_function(pctl, df->name, functions))
283283
(functions + pctl->nfuncs++)->name = df->name;
284-
pctl->functions = devm_kmemdup(pctl->dev, functions,
285-
pctl->nfuncs * sizeof(*functions),
286-
GFP_KERNEL);
284+
pctl->functions = devm_kmemdup_array(pctl->dev, functions, pctl->nfuncs,
285+
sizeof(*functions), GFP_KERNEL);
287286
if (!pctl->functions)
288287
return -ENOMEM;
289288

@@ -314,7 +313,8 @@ static int pxa2xx_build_groups(struct pxa_pinctrl *pctl)
314313
pctl->ppins[j].pin.name;
315314
func = pctl->functions + i;
316315
func->ngroups = ngroups;
317-
func->groups = devm_kmemdup(pctl->dev, gtmp, ngroups * sizeof(*gtmp), GFP_KERNEL);
316+
func->groups = devm_kmemdup_array(pctl->dev, gtmp, ngroups,
317+
sizeof(*gtmp), GFP_KERNEL);
318318
if (!func->groups)
319319
return -ENOMEM;
320320
}

0 commit comments

Comments
 (0)