pinctrl: single: Fix a couple error codes
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 16 Nov 2016 11:41:51 +0000 (14:41 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 16 Nov 2016 19:56:19 +0000 (20:56 +0100)
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>
drivers/pinctrl/pinctrl-single.c

index 2b196e53d937a0cb86cbf81889ae432c511f3d32..a5a0392ab8175da62001816e3f7eb7a2600f1b08 100644 (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)