]> git.baikalelectronics.ru Git - kernel.git/commit
pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
authorYueHaibing <yuehaibing@huawei.com>
Wed, 1 Aug 2018 05:10:49 +0000 (13:10 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 3 Aug 2018 17:28:15 +0000 (19:28 +0200)
commit0ced75cd32af688b30e06eeb8bbfbae707dc23d0
tree05945a16717151f2cb1d3489f28cf52c0a1bb791
parent1a2e44049561340e77b87a05e41d0ea9b1b83bd0
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: c096a8bd6a31 ("pinctrl: berlin: add the core pinctrl driver for Marvell Berlin SoCs")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/berlin/berlin.c