summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-11-18 14:35:57 +0300
committerLinus Walleij <linus.walleij@linaro.org>2016-11-22 09:55:33 +0100
commitb3cde198b17f504643cc1eeffc4623f03326f436 (patch)
treeb8d0477d4146d4a9da16ce266d19caa92a2c78c6 /drivers/pinctrl
parent04d02c7a5ec68debdab8eb71bffe8a9381cb1b1a (diff)
downloadop-kernel-dev-b3cde198b17f504643cc1eeffc4623f03326f436.zip
op-kernel-dev-b3cde198b17f504643cc1eeffc4623f03326f436.tar.gz
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 6b7953d..0eb51e3 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -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;
}
OpenPOWER on IntegriCloud