summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-single.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-11-16 12:41:51 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-11-16 20:56:19 +0100
commit712778d02d5c24e0bb5cfb9ccb9213496853a57f (patch)
tree9900c29cff035bb1042135009340eb69dbc9cb04 /drivers/pinctrl/pinctrl-single.c
parentpinctrl: sunxi: fix theoretical uninitialized variable access (diff)
downloadlinux-712778d02d5c24e0bb5cfb9ccb9213496853a57f.tar.xz
linux-712778d02d5c24e0bb5cfb9ccb9213496853a57f.zip
pinctrl: single: Fix a couple error codes
We should return -ENOMEM instead of success if pcs_add_function() fails. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-single.c')
-rw-r--r--drivers/pinctrl/pinctrl-single.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 2b196e53d937..a5a0392ab817 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1181,8 +1181,10 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
pgnames[0] = np->name;
function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1);
- if (!function)
+ if (!function) {
+ res = -ENOMEM;
goto free_pins;
+ }
res = pcs_add_pingroup(pcs, np, np->name, pins, found);
if (res < 0)
@@ -1313,8 +1315,10 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
pgnames[0] = np->name;
function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1);
- if (!function)
+ if (!function) {
+ res = -ENOMEM;
goto free_pins;
+ }
res = pcs_add_pingroup(pcs, np, np->name, pins, found);
if (res < 0)