Re: [PATCH] ASoC: mediatek: mt6797: Fix runtime PM handling in probe

From: Mark Brown

Date: Fri Nov 20 2026 - 11:22:50 EST


> The MT6797 AFE probe registers its components even when the runtime
> resume fails to enable the clocks. If component registration fails
> after a successful resume, the probe disables runtime PM while still
> holding its usage reference. The runtime PM disabled path also
> returns the previous successful result without registering components.

> @@ -846,11 +851,13 @@ static int mt6797_afe_pcm_dev_probe(struct platform_device *pdev)
> afe->num_dai_drivers);
> if (ret) {
> dev_warn(dev, "err_dai_component\n");
> - goto err_pm_disable;
> + goto err_pm_put;
> }
>
> return 0;
>
> +err_pm_put:
> + pm_runtime_put_sync_suspend(dev);

There's a race with userspace fiddling with runtime PM here, it can
force runtime PM on. Instead drop the reference with
pm_runtime_put_noidle(), disable runtime PM and then directly call the
suspend function to ensure the hardware is i the right state.

--
Mark Brown <broonie@xxxxxxxxxx>