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>
This commit is contained in:
Dan Carpenter 2016-11-16 14:41:51 +03:00 committed by Linus Walleij
parent d8a2221273
commit 712778d02d
1 changed files with 6 additions and 2 deletions

View File

@ -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)