Commit b3cde198 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Walleij
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 04d02c7a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
}