Skip to content
Commit bba2e871 authored by Shawn Guo's avatar Shawn Guo Committed by Linus Walleij
Browse files

pinctrl: zte: fix 'functions' allocation in zx_pinctrl_build_state()



It fixes the following Smatch static check warning:

 drivers/pinctrl/zte/pinctrl-zx.c:338 zx_pinctrl_build_state()
 warn: passing devm_ allocated variable to kfree.

As we will be calling krealloc() on pointer '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.

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: cbff0c4d ("pinctrl: add ZTE ZX pinctrl driver support")
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 8939aa5f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment