Thread (5 messages) flat view 5 messages, 3 authors, 2017-08-02

[PATCH] pinctrl: zte: fix 'functions' allocation in zx_pinctrl_build_state()

From: Linus Walleij <hidden>
Date: 2017-08-02 08:32:01
Also in: linux-gpio

On Sun, Jul 16, 2017 at 3:33 PM, Shawn Guo [off-list ref] wrote:
From: Shawn Guo <redacted>

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: Dan Carpenter <redacted>
Fixes: cbff0c4d27f4 ("pinctrl: add ZTE ZX pinctrl driver support")
Signed-off-by: Shawn Guo <redacted>
Patch applied.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help