public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Zhen Ni <nizhen@uniontech.com>
Cc: frattaroli.nicolas@gmail.com, lgirdwood@gmail.com,
	broonie@kernel.org, tiwai@suse.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error
Date: Wed, 02 Mar 2022 11:04:06 +0100	[thread overview]
Message-ID: <s5hee3koell.wl-tiwai@suse.de> (raw)
In-Reply-To: <20220302100019.22891-1-nizhen@uniontech.com>

On Wed, 02 Mar 2022 11:00:19 +0100,
Zhen Ni wrote:
> 
> pm_runtime_get_sync() increments the runtime PM usage counter even the
> call returns an error code. Thus a pairing decrement is needed on the
> error handling path to keep the counter balanced.
> 
> Signed-off-by: Zhen Ni <nizhen@uniontech.com>

Better to use a new function pm_runtime_resume_and_get().


thanks,

Takashi

> ---
>  sound/soc/rockchip/rockchip_i2s_tdm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
> index 5f9cb5c4c7f0..4691a76b499d 100644
> --- a/sound/soc/rockchip/rockchip_i2s_tdm.c
> +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
> @@ -1739,8 +1739,10 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)
>  	int ret;
>  
>  	ret = pm_runtime_get_sync(dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put(dev);
>  		return ret;
> +	}
>  	ret = regcache_sync(i2s_tdm->regmap);
>  	pm_runtime_put(dev);
>  
> -- 
> 2.20.1
> 
> 
> 

      reply	other threads:[~2022-03-02 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 10:00 [PATCH] ASoC: rockchip: i2s_tdm: fix runtime pm imbalance on error Zhen Ni
2022-03-02 10:04 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hee3koell.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nizhen@uniontech.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox