diff mbox series

[v2,-next,4/4] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe

Message ID 20220929150653.63845-5-zhangqilong3@huawei.com (mailing list archive)
State New, archived
Headers show
Series Fix PM disable depth imbalance in probe | expand

Commit Message

Zhang Qilong Sept. 29, 2022, 3:06 p.m. UTC
The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. We fix it by calling
pm_runtime_disable when error returns.

Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
v2:
- call pm_runtime_disable when error returns
---
 sound/soc/codecs/mt6660.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

AngeloGioacchino Del Regno Sept. 30, 2022, 8:39 a.m. UTC | #1
Il 29/09/22 17:06, Zhang Qilong ha scritto:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by calling
> pm_runtime_disable when error returns.
> 
> Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mark Brown Oct. 3, 2022, 5:37 p.m. UTC | #2
On Thu, Sep 29, 2022 at 11:06:53PM +0800, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. We fix it by calling
> pm_runtime_disable when error returns.

This doesn't apply against current code, please check and resend.
diff mbox series

Patch

diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c
index 4971cd0b90f8..36220a1f80a6 100644
--- a/sound/soc/codecs/mt6660.c
+++ b/sound/soc/codecs/mt6660.c
@@ -509,6 +509,9 @@  static int mt6660_i2c_probe(struct i2c_client *client)
 	ret = devm_snd_soc_register_component(chip->dev,
 					       &mt6660_component_driver,
 					       &mt6660_codec_dai, 1);
+	if (ret)
+		pm_runtime_disable(chip->dev);
+
 	return ret;
 probe_fail:
 	_mt6660_chip_power_on(chip, 0);