Skip to content

Commit

Permalink
ASoC: wm8962: balance pm_runtime_enable
Browse files Browse the repository at this point in the history
pm_runtime_enable is called in probe to enable runtime PM
for wm8962 codec, but pm_runtime_disable isn't called in remove
callback, nor is called in error path if probe fails after runtime
PM is enabled, this causes unbalanced pm_runtime_enable.

This patch Adds pm_runtime_disable in remove callback and error path,
to balance pm_runtime_enable.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Jiada Wang authored and Mark Brown committed Sep 30, 2015
1 parent 6ff33f3 commit 57622ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/soc/codecs/wm8962.c
Original file line number Diff line number Diff line change
Expand Up @@ -3759,7 +3759,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8962, &wm8962_dai, 1);
if (ret < 0)
goto err_enable;
goto err_pm_runtime;

regcache_cache_only(wm8962->regmap, true);

Expand All @@ -3768,6 +3768,8 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,

return 0;

err_pm_runtime:
pm_runtime_disable(&i2c->dev);
err_enable:
regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
err:
Expand All @@ -3777,6 +3779,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
static int wm8962_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
pm_runtime_disable(&client->dev);
return 0;
}

Expand Down

0 comments on commit 57622ae

Please sign in to comment.