linux/drivers/pinctrl/berlin
YueHaibing 31c442b69c pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
commit b5031b7db7 upstream.

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: 3de68d331c ("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>
[bwh: Backported to 3.16: berlin_pinctrl_state() was not yet converted
 to devm_kcalloc()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-12-16 22:08:34 +00:00
..
berlin-bg2.c pinctrl: berlin: Use devm_ioremap_resource() 2014-05-27 16:03:24 +02:00
berlin-bg2cd.c pinctrl: berlin: Use devm_ioremap_resource() 2014-05-27 16:03:24 +02:00
berlin-bg2q.c pinctrl: berlin: Use devm_ioremap_resource() 2014-05-27 16:03:24 +02:00
berlin.c pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state 2018-12-16 22:08:34 +00:00
berlin.h pinctrl: berlin: add the core pinctrl driver for Marvell Berlin SoCs 2014-05-23 00:05:00 +02:00
Kconfig pinctrl: berlin: add the BG2CD pinctrl driver 2014-05-23 00:06:38 +02:00
Makefile pinctrl: berlin: add the BG2CD pinctrl driver 2014-05-23 00:06:38 +02:00