[PATCH] ASoC: rt5670: Remove unbalanced pm_runtime_put()

Cezary Rojewski cezary.rojewski at intel.com
Tue Dec 13 13:55:50 CET 2022


On 2022-12-13 1:33 PM, Hans de Goede wrote:
> For some reason rt5670_i2c_probe() does a pm_runtime_put() at the end
> of a successful probe. But it has never done a pm_runtime_get() leading
> to the following error being logged into dmesg:
> 
>   rt5670 i2c-10EC5640:00: Runtime PM usage count underflow!
> 
> Fix this by removing the unnecessary pm_runtime_put().
> 
> Fixes: 64e89e5f5548 ("ASoC: rt5670: Add runtime PM support")
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>   sound/soc/codecs/rt5670.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
> index ebac6caeb40a..a230f441559a 100644
> --- a/sound/soc/codecs/rt5670.c
> +++ b/sound/soc/codecs/rt5670.c
> @@ -3311,8 +3311,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c)
>   	if (ret < 0)
>   		goto err;
>   
> -	pm_runtime_put(&i2c->dev);
> -
>   	return 0;
>   err:
>   	pm_runtime_disable(&i2c->dev);


Hello Hans,

Good finding, weird one though. I just analyzed commit pointed by 
64e89e5f5548 and it seems that entire change could be reverted. The 
rt5670 i2c_driver does not assign any PM ops, only ASoC component ones. 
The later is tied to machine board driver though (and it assigning 
snd_soc_pm_ops in its descriptor).

 From i2s (non-sdw) Realtek codec drivers found in sound/soc/codecs it 
seems that only rt9120.c defines PM ops and configures the PM for the 
device. OTOH, there are several which define suspend/resume on ASoC 
component level and do not touch pm_runtime_* at all.

Thus, voting for a complete revert.


Regards,
Czarek


More information about the Alsa-devel mailing list