Skip to content

Commit de84503

Browse files
imtangmengLinus Walleij
authored andcommitted
pinctrl: berlin: fix error return code of berlin_pinctrl_build_state()
When krealloc() fails and pctrl->functions is NULL, no error return code of berlin_pinctrl_build_state() is assigned. To fix this bug, ret is assigned with -ENOMEM when pctrl->functions is NULL. Signed-off-by: Meng Tang <tangmeng@uniontech.com> Link: https://lore.kernel.org/r/20220303080206.16463-1-tangmeng@uniontech.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent c0e4c71 commit de84503

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/pinctrl/berlin/berlin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev)
233233
pctrl->functions = krealloc(pctrl->functions,
234234
pctrl->nfunctions * sizeof(*pctrl->functions),
235235
GFP_KERNEL);
236+
if (!pctrl->functions)
237+
return -ENOMEM;
236238

237239
/* map functions to theirs groups */
238240
for (i = 0; i < pctrl->desc->ngroups; i++) {

0 commit comments

Comments
 (0)