[PATCH -next] pinctrl: sunxi: fix 'pctrl->functions' allocation in sunxi_pinctrl_build_state
linus.walleij at linaro.org
Fri Sep 21 09:18:22 PDT 2018
On Thu, Sep 20, 2018 at 7:00 PM YueHaibing <yuehaibing at huawei.com> wrote:
> fixes following Smatch static check warning:
> ./drivers/pinctrl/sunxi/pinctrl-sunxi.c:1112 sunxi_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: 0e37f88d9ad8 ("ARM: sunxi: Add pinctrl driver for Allwinner SoCs")
> Signed-off-by: YueHaibing <yuehaibing at huawei.com>
Patch applied with Maxime's ACK.
More information about the linux-arm-kernel