Messages in this thread | | | From | Linus Walleij <> | Date | Thu, 29 Nov 2018 16:52:04 +0100 | Subject | Re: [PATCH 00/10] Regulator ena_gpiod fixups |
| |
On Wed, Nov 28, 2018 at 4:22 PM Charles Keepax <ckeepax@opensource.cirrus.com> wrote:
> It looks like the patches are assuming the regulator core, > doesn't free the GPIO on an error, however that is not true in > all cases. If only a single regulator has requested the GPIO then > all the error paths after the call to regulator_ena_gpio_request > in regulator_register will free the GPIO.
I guess part of it is that I should make sure not to gpiod_put() if the [devm_]regulator_register() fails, I will go over the series with that in mind!
Essentially the semantic is that the [devm_]regulator_register() call will immediately take ownership of the descriptor and place it in the regulator core.
I'll check!
> Although this is not the > case if more than one regulator has requested the GPIO.
This should be fine since the regulator core refcounts it, when all the other regulators drops it, gpiod_put() will be called as the refcount goes down to 0.
Yours, Linus Walleij
| |