diff mbox

[3/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Message ID 1486980666-7143-3-git-send-email-ckeepax@opensource.wolfsonmicro.com
State New
Headers show

Commit Message

Charles Keepax Feb. 13, 2017, 10:11 a.m. UTC
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Krzysztof Kozlowski Feb. 15, 2017, 5:39 p.m. UTC | #1
On Mon, Feb 13, 2017 at 10:11:05AM +0000, Charles Keepax wrote:
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Empty? Please say WHY we want to use devres version of
gpiochip_add_data (e.g. for simplification of error paths).

Best regards,
Krzysztof


> ---
>  drivers/pinctrl/samsung/pinctrl-samsung.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index 1134bc3..f291cbf 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -936,20 +936,15 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
>  		gc->of_node = bank->of_node;
>  		gc->label = bank->name;
>  
> -		ret = gpiochip_add_data(gc, bank);
> +		ret = devm_gpiochip_add_data(&pdev->dev, gc, bank);
>  		if (ret) {
>  			dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
>  							gc->label, ret);
> -			goto fail;
> +			return ret;
>  		}
>  	}
>  
>  	return 0;
> -
> -fail:
> -	for (--i, --bank; i >= 0; --i, --bank)
> -		gpiochip_remove(&bank->gpio_chip);
> -	return ret;
>  }
>  
>  /* retrieve the soc specific data */
> -- 
> 2.1.4
> 
--
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/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 1134bc3..f291cbf 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -936,20 +936,15 @@  static int samsung_gpiolib_register(struct platform_device *pdev,
 		gc->of_node = bank->of_node;
 		gc->label = bank->name;
 
-		ret = gpiochip_add_data(gc, bank);
+		ret = devm_gpiochip_add_data(&pdev->dev, gc, bank);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
 							gc->label, ret);
-			goto fail;
+			return ret;
 		}
 	}
 
 	return 0;
-
-fail:
-	for (--i, --bank; i >= 0; --i, --bank)
-		gpiochip_remove(&bank->gpio_chip);
-	return ret;
 }
 
 /* retrieve the soc specific data */