Messages in this thread Patch in this message | | | From | Linus Walleij <> | Subject | [PATCH 01/10] regulator: fixed: Let core handle GPIO descriptor | Date | Wed, 28 Nov 2018 11:43:41 +0100 |
| |
Use the gpiod_get() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors.
Fixes: efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/regulator/fixed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index ccc29038f19a..52091ebf7164 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -183,7 +183,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) */ gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, gflags); + cfg.ena_gpiod = gpiod_get_optional(&pdev->dev, NULL, gflags); if (IS_ERR(cfg.ena_gpiod)) return PTR_ERR(cfg.ena_gpiod); @@ -195,6 +195,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc, &cfg); if (IS_ERR(drvdata->dev)) { + if (cfg.ena_gpiod) + gpiod_put(cfg.ena_gpiod); ret = PTR_ERR(drvdata->dev); dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); return ret; -- 2.19.1
| |