diff mbox

pinctrl: single: Fix a couple error codes

Message ID 20161116114151.GA31224@mwanda
State New
Headers show

Commit Message

Dan Carpenter Nov. 16, 2016, 11:41 a.m. UTC
We should return -ENOMEM instead of success if pcs_add_function() fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tony Lindgren Nov. 16, 2016, 2:49 p.m. UTC | #1
* Dan Carpenter <dan.carpenter@oracle.com> [161116 03:43]:
> We should return -ENOMEM instead of success if pcs_add_function() fails.

Looks good to me thanks:

Acked-by: Tony Lindgren <tony@atomide.com>

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index 2b196e5..a5a0392 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Nov. 16, 2016, 7:57 p.m. UTC | #2
On Wed, Nov 16, 2016 at 12:41 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> We should return -ENOMEM instead of success if pcs_add_function() fails.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied with Tony's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 2b196e5..a5a0392 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)