Re: [PATCH 0/5] Add TI LM51772 buck-boost voltage regulator
From: Mark Brown
Date: Thu Oct 22 2026 - 09:43:51 EST
On Wed, Oct 21, 2026 at 12:27:41PM +0200, Paul Louvel wrote:
> static int ptn5110_tcpc_set_vbus(struct tcpci *tcpci, struct tcpci_data *data, bool source,
> bool sink)
> {
> struct ptn5110_priv *priv = container_of(data, struct ptn5110_priv, data);
> int ret;
>
> ret = regulator_is_enabled(priv->vbus_high);
> if (ret < 0)
> return ret;
>
> if (ret && !source)
> return regulator_disable(priv->vbus_high);
This is buggy, if the driver is not using regulator_get_exclusive() it
has no idea why the underlying physical regulator is enabled or if it
has the ability to affect that state. Even if the regulator is held
exclusively we still do reference counting for the driver so it needs to
be certain that it never enables twice. Outside of bootstrapping your
driver's internal state you should neve use regulator_is_enabled().
Attachment:
signature.asc
Description: PGP signature