mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
91bfcc7a2f
commit
86068aca75
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue