mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
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: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
04d02c7a5e
commit
b3cde198b1
1 changed files with 3 additions and 2 deletions
|
@ -398,13 +398,14 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||||
* map array
|
* map array
|
||||||
*/
|
*/
|
||||||
*map = krealloc(*map, i * sizeof(struct pinctrl_map), GFP_KERNEL);
|
*map = krealloc(*map, i * sizeof(struct pinctrl_map), GFP_KERNEL);
|
||||||
if (!map)
|
if (!*map)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_free_map:
|
err_free_map:
|
||||||
kfree(map);
|
kfree(*map);
|
||||||
|
*map = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue