Re: [PATCH 15/21] ASoC: wm8985: Move regulator acquisition to the bus probe
From: Chancel Liu
Date: Mon Sep 21 2026 - 22:02:59 EST
Hi Charles,
Many thanks for your review.
On 9/21/2026 7:52 PM, Charles Keepax wrote:
> 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
Agreed, It looks better this way. I'll improve it in the next revision.
Regards,
Chancel Liu