[PATCH v2 0/2] ASoC: Fix error handling in arizona
The first patch fixed a wrong free in wm8997_probe. The other fixed PM disable depth imbalance on error handling.
Change Log v2: - add collected review and ack.
Zhang Qilong (2): ASoC: arizona: Fix a wrong free in wm8997_probe ASoC: arizona: Fix PM disable depth imbalance on error
sound/soc/codecs/wm8997.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
In the normal path, we should not free the arizona, we should return immediately. It will be free when call remove operation.
Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs into bus probe") Reported-by: Richard Fitzgerald rf@opensource.cirrus.com Signed-off-by: Zhang Qilong zhangqilong3@huawei.com Acked-by: Richard Fitzgerald rf@opensource.cirrus.com --- sound/soc/codecs/wm8997.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 37e4bb3dbd8a..229f2986cd96 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1177,6 +1177,8 @@ static int wm8997_probe(struct platform_device *pdev) goto err_spk_irqs; }
+ return ret; + err_spk_irqs: arizona_free_spk_irqs(arizona);
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.
Fixes: 85e7dd3f871b9 ("ASoC: arizona: Add support for setting the output volume limits") Signed-off-by: Zhang Qilong zhangqilong3@huawei.com --- sound/soc/codecs/wm8997.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 229f2986cd96..014328162262 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1163,10 +1163,10 @@ static int wm8997_probe(struct platform_device *pdev)
ret = arizona_init_vol_limit(arizona); if (ret < 0) - return ret; + goto err_pm_disable; ret = arizona_init_spk_irqs(arizona); if (ret < 0) - return ret; + goto err_pm_disable;
ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8997, @@ -1181,6 +1181,8 @@ static int wm8997_probe(struct platform_device *pdev)
err_spk_irqs: arizona_free_spk_irqs(arizona); +err_pm_disable: + pm_runtime_disable(&pdev->dev);
return ret; }
On Thu, Nov 12, 2020 at 08:41:38PM +0800, Zhang Qilong wrote:
The first patch fixed a wrong free in wm8997_probe. The other fixed PM disable depth imbalance on error handling.
Change Log v2:
- add collected review and ack.
Please don't resend for this, it just adds to the noise and makes things more work to manage.
participants (2)
-
Mark Brown
-
Zhang Qilong