Re: [PATCH 15/21] ASoC: wm8985: Move regulator acquisition to the bus probe

From: Charles Keepax

Date: Mon Sep 21 2026 - 08:22:56 EST


On Mon, Sep 21, 2026 at 07:46:34PM +0900, Chancel Liu wrote:
> From: Chancel Liu <chancel.liu@xxxxxxx>
>
> component->dev is the underlying i2c/spi device whose devres is only
> released on physical device removal, not on ASoC card unbind. Getting
> the regulator supplies with devm_regulator_bulk_get(component->dev, ...)
> in the component probe therefore leaks the regulator references on every
> card bind/unbind cycle.
>
> Move the devm_regulator_bulk_get() into a helper called from the i2c and
> spi probes so the supplies are tied to the physical device lifetime.
>
> Signed-off-by: Chancel Liu <chancel.liu@xxxxxxx>
> ---
> @@ -1176,6 +1178,12 @@ static int wm8985_spi_probe(struct spi_device *spi)
> + ret = wm8985_get_regulators(&spi->dev, wm8985);
> + if (ret) {
> + dev_err(&spi->dev, "Failed to request supplies: %d\n", ret);
> + return ret;
> + }
> @@ -1212,6 +1220,12 @@ static int wm8985_i2c_probe(struct i2c_client *i2c)
> + ret = wm8985_get_regulators(&i2c->dev, wm8985);
> + if (ret) {
> + dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
> + return ret;
> + }

Probably slightly nicer to include the error message in the
helper rather than duplicating it in each probe.

Thanks,
Charles