提交 b3cde198 编写于 作者: D Dan Carpenter 提交者: Linus Walleij

pinctrl: sunxi: Testing the wrong variable

Smatch complains that we dereference "map" before testing it for NULL
which is true.  We should be testing "*map" instead.  Also on the error
path, we should free *map and set it to NULL.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 04d02c7a
......@@ -398,13 +398,14 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
* map array
*/
*map = krealloc(*map, i * sizeof(struct pinctrl_map), GFP_KERNEL);
if (!map)
if (!*map)
return -ENOMEM;
return 0;
err_free_map:
kfree(map);
kfree(*map);
*map = NULL;
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册