[07/10] regulator: da9211: Let core handle GPIO descriptors
diff mbox series

Message ID 20181128104350.31902-8-linus.walleij@linaro.org
State Superseded
Headers show
Series
  • Regulator ena_gpiod fixups
Related show

Commit Message

Linus Walleij Nov. 28, 2018, 10:43 a.m. UTC
Use the gpiod_get_from_of_node() rather than the devm_*
version so that the regulator core can handle the lifecycle
of these descriptors.

This patch requires "gpio: Export gpiod_get_from_of_node()"
to be applied first.

Fixes: 11da04af0d3b ("regulator: da9211: Pass descriptors instead of GPIO numbers")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/regulator/da9211-regulator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Charles Keepax Nov. 28, 2018, 3:11 p.m. UTC | #1
On Wed, Nov 28, 2018 at 11:43:47AM +0100, Linus Walleij wrote:
> Use the gpiod_get_from_of_node() rather than the devm_*
> version so that the regulator core can handle the lifecycle
> of these descriptors.
> 
> This patch requires "gpio: Export gpiod_get_from_of_node()"
> to be applied first.
> 
> Fixes: 11da04af0d3b ("regulator: da9211: Pass descriptors instead of GPIO numbers")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/regulator/da9211-regulator.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
> index 8f68c7a05d27..bfdead356526 100644
> --- a/drivers/regulator/da9211-regulator.c
> +++ b/drivers/regulator/da9211-regulator.c
> @@ -293,8 +293,8 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
>  
>  		pdata->init_data[n] = da9211_matches[i].init_data;
>  		pdata->reg_node[n] = da9211_matches[i].of_node;
> -		pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
> -				  da9211_matches[i].of_node,
> +		pdata->gpiod_ren[n] =
> +			gpiod_get_from_of_node(da9211_matches[i].of_node,

This driver has a lot of error paths that will leak the GPIO with
this change.

Thanks,
Charles

>  				  "enable",
>  				  0,
>  				  GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
> -- 
> 2.19.1

Patch
diff mbox series

diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index 8f68c7a05d27..bfdead356526 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -293,8 +293,8 @@  static struct da9211_pdata *da9211_parse_regulators_dt(
 
 		pdata->init_data[n] = da9211_matches[i].init_data;
 		pdata->reg_node[n] = da9211_matches[i].of_node;
-		pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
-				  da9211_matches[i].of_node,
+		pdata->gpiod_ren[n] =
+			gpiod_get_from_of_node(da9211_matches[i].of_node,
 				  "enable",
 				  0,
 				  GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,