Skip to content
Commit b5031b7d authored by YueHaibing's avatar YueHaibing Committed by Linus Walleij
Browse files

pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state



fixes following Smatch static check warning:

 drivers/pinctrl/berlin/berlin.c:237 berlin_pinctrl_build_state()
 warn: passing devm_ allocated variable to kfree. 'pctrl->functions'

As we will be calling krealloc() on pointer 'pctrl->functions', which means
kfree() will be called in there, devm_kzalloc() shouldn't be used with
the allocation in the first place.  Fix the warning by calling kcalloc()
and managing the free procedure in error path on our own.

Fixes: 3de68d33 ("pinctrl: berlin: add the core pinctrl driver for Marvell Berlin SoCs")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Reviewed-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 40b25bce
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment