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

From: Charles Keepax

Date: Thu Nov 05 2026 - 05:27:41 EST


On Thu, Nov 05, 2026 at 10:02:00AM +0000, Charles Keepax wrote:
> On Wed, Nov 04, 2026 at 10:38:32PM -0800, Dmitry Torokhov wrote:
> > 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>
> > ---
>
> Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Seems Lee has sent an almost identical patch:

https://lore.kernel.org/lkml/20261104182148.1176116-3-lee@xxxxxxxxxx/

Perhaps we should go with that version as it also removes the
now redundant platform_set_drvdata.

Thanks,
Charles