pinctrl: sunxi: Fix potential null pointer dereference
kzalloc can fail. Add a null check to avoid null pointer dereference error while accessing the pointer later. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
7171511eae
commit
bd07894e21
@ -211,6 +211,10 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||
configlen++;
|
||||
|
||||
pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL);
|
||||
if (!pinconfig) {
|
||||
kfree(*map);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (!of_property_read_u32(node, "allwinner,drive", &val)) {
|
||||
u16 strength = (val + 1) * 10;
|
||||
|
Loading…
Reference in New Issue
Block a user