[PATCH] regulator: arizona-ldo1: Fix double gpiod_put() on enable GPIO

From: Dmitry Torokhov

Date: Thu Nov 05 2026 - 01:39:12 EST


When arizona-ldo1 registers the regulator, the regulator core takes
ownership of the GPIO descriptor passed in regulator_config.ena_gpiod.
The core frees this enable GPIO descriptor both on registration error
and when the regulator device is unregistered.

Because the driver also tracked the descriptor and called gpiod_put()
in its driver remove callback, unbinding the driver causes a duplicate
gpiod_put(). Remove the driver remove callback and stop storing the
enable GPIO descriptor in driver private data to avoid the double
free.

Fixes: a9191579ba10 ("regulator: arizona-ldo1: Use correct device to get enable GPIO")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/regulator/arizona-ldo1.c | 14 --------------
1 file changed, 14 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 501843996faa..f719158ac360 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -35,8 +35,6 @@ struct arizona_ldo1 {

struct regulator_consumer_supply supply;
struct regulator_init_data init_data;
-
- struct gpio_desc *ena_gpiod;
};

static int arizona_ldo1_hc_set_voltage_sel(struct regulator_dev *rdev,
@@ -262,8 +260,6 @@ static int arizona_ldo1_common_init(struct platform_device *pdev,
if (IS_ERR(config.ena_gpiod))
return PTR_ERR(config.ena_gpiod);

- ldo1->ena_gpiod = config.ena_gpiod;
-
if (pdata->init_data)
config.init_data = pdata->init_data;
else
@@ -339,14 +335,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
return ret;
}

-static void arizona_ldo1_remove(struct platform_device *pdev)
-{
- struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev);
-
- if (ldo1->ena_gpiod)
- gpiod_put(ldo1->ena_gpiod);
-}
-
static int madera_ldo1_probe(struct platform_device *pdev)
{
struct madera *madera = dev_get_drvdata(pdev->dev.parent);
@@ -375,7 +363,6 @@ static int madera_ldo1_probe(struct platform_device *pdev)

static struct platform_driver arizona_ldo1_driver = {
.probe = arizona_ldo1_probe,
- .remove = arizona_ldo1_remove,
.driver = {
.name = "arizona-ldo1",
.probe_type = PROBE_FORCE_SYNCHRONOUS,
@@ -384,7 +371,6 @@ static struct platform_driver arizona_ldo1_driver = {

static struct platform_driver madera_ldo1_driver = {
.probe = madera_ldo1_probe,
- .remove = arizona_ldo1_remove,
.driver = {
.name = "madera-ldo1",
.probe_type = PROBE_FORCE_SYNCHRONOUS,

---
base-commit: d6bcfc94eb4da6e089c5473970cd96727292fd97
change-id: 20261104-arizona-ldo1-gpiod-fix-48e94fe22e18

Thanks.

--
Dmitry