Re: [PATCH 2/4] ASoC: SDCA: enable pm_runtime before taking the initial reference

From: Charles Keepax

Date: Mon Oct 19 2026 - 04:40:19 EST


On Sun, Oct 18, 2026 at 08:23:57PM +0100, Srinivas Kandagatla wrote:
> If devm_pm_runtime_enable() failed, the usage count taken earlier by
> pm_runtime_get_noresume() was never dropped. Reorder so the get only
> happens once enable has succeeded.
>
> Fixes: 2d877d0659cb ("ASoC: SDCA: Add basic SDCA class driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
> ---
> sound/soc/sdca/sdca_class.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/sdca/sdca_class.c b/sound/soc/sdca/sdca_class.c
> index bcc660aeb739..3361db188046 100644
> --- a/sound/soc/sdca/sdca_class.c
> +++ b/sound/soc/sdca/sdca_class.c
> @@ -194,12 +194,13 @@ int sdca_class_probe(struct sdw_slave *sdw,
> pm_runtime_set_autosuspend_delay(dev, 250);
> pm_runtime_use_autosuspend(dev);
> pm_runtime_set_active(dev);
> - pm_runtime_get_noresume(dev);
>
> ret = devm_pm_runtime_enable(dev);
> if (ret)
> return ret;
>
> + pm_runtime_get_noresume(dev);

I think it would be better to drop the reference on the error
path. Doing it this way round there is a very small chance that
the device auto-suspends between the enable and get_noresume.
The intention was to keep everything powered on until bring up
was complete.

Thanks,
Charles