|
@@ -216,10 +216,8 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
|
|
}
|
|
}
|
|
|
|
|
|
/* we will reallocate later */
|
|
/* we will reallocate later */
|
|
- pctrl->functions = devm_kcalloc(&pdev->dev,
|
|
|
|
- max_functions,
|
|
|
|
- sizeof(*pctrl->functions),
|
|
|
|
- GFP_KERNEL);
|
|
|
|
|
|
+ pctrl->functions = kcalloc(max_functions,
|
|
|
|
+ sizeof(*pctrl->functions), GFP_KERNEL);
|
|
if (!pctrl->functions)
|
|
if (!pctrl->functions)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
@@ -257,8 +255,10 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
|
|
function++;
|
|
function++;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!found)
|
|
|
|
|
|
+ if (!found) {
|
|
|
|
+ kfree(pctrl->functions);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
+ }
|
|
|
|
|
|
if (!function->groups) {
|
|
if (!function->groups) {
|
|
function->groups =
|
|
function->groups =
|
|
@@ -267,8 +267,10 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
|
|
sizeof(char *),
|
|
sizeof(char *),
|
|
GFP_KERNEL);
|
|
GFP_KERNEL);
|
|
|
|
|
|
- if (!function->groups)
|
|
|
|
|
|
+ if (!function->groups) {
|
|
|
|
+ kfree(pctrl->functions);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
groups = function->groups;
|
|
groups = function->groups;
|