Re: [PATCH 02/10] regulator: arizona-ldo1: Avoid double gpiod_put() on enable GPIO

From: Charles Keepax

Date: Thu Nov 05 2026 - 05:18:40 EST


On Wed, Nov 04, 2026 at 06:20:52PM +0000, Lee Jones wrote:
> Passing config.ena_gpiod to devm_regulator_register() transfers ownership
> of the GPIO descriptor to the regulator core, which releases it via
> gpiod_put() in regulator_ena_gpio_free() upon registration failure or
> when devres unregisters the regulator.
>
> Calling gpiod_put(ldo1->ena_gpiod) in arizona_ldo1_remove() prematurely
> frees the enable GPIO while the regulator is still registered and causes
> a second gpiod_put() when devm_rdev_release() runs. Drop the redundant
> remove callback and ena_gpiod field so the regulator core manages the
> descriptor lifetime exclusively.
>
> Fixes: a9191579ba10 ("regulator: arizona-ldo1: Use correct device to get enable GPIO")
> Closes: https://sashiko.dev/#/bug/linux-7988402e-ca08-4bd3-9488-5779d6da0450
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles