mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Pengpeng Hou <hppiscas@163.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/9] ASoC: wm8978: stop resume after register restore errors
Date: Mon, 7 Sep 2026 11:47:32 +0100	[thread overview]
Message-ID: <ap6WRKa1ty7CQSYR@opensource.cirrus.com> (raw)
In-Reply-To: <20260906034321.86080-8-hppiscas@163.com>

On Sun, Sep 06, 2026 at 11:43:19AM +0800, Pengpeng Hou wrote:
> wm8978_resume() ignores failures from cache replay, bias restoration and
> PLL re-enable. It can therefore continue publishing later resume steps
> after the codec restore transaction has already failed.
> 
> Return the first negative result from those ordered operations. Treat
> the positive "register changed" result from
> snd_soc_component_update_bits() as success, as required by the component
> resume callback contract. The ASoC wrapper reports failures and retains
> best-effort card resume.
> 
> The issue was found by our static-analysis tool and manually reviewed.
> 
> Fixes: 0d34e91596ef ("ASoC: add a WM8978 codec driver")
> Assisted-by: gpt 5
> Signed-off-by: Pengpeng Hou <hppiscas@163.com>
> ---
>  sound/soc/codecs/wm8978.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
> index ad8064bbaaac..241d17d81ecb 100644
> --- a/sound/soc/codecs/wm8978.c
> +++ b/sound/soc/codecs/wm8978.c
> @@ -940,15 +940,25 @@ static int wm8978_resume(struct snd_soc_component *component)
>  {
>  	struct wm8978_priv *wm8978 = snd_soc_component_get_drvdata(component);
>  	struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
> +	int ret;
>  
>  	/* Sync reg_cache with the hardware */
> -	regcache_sync(wm8978->regmap);
> +	ret = regcache_sync(wm8978->regmap);
> +	if (ret)
> +		return ret;
>  
> -	snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
> +	ret = snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY);
> +	if (ret)
> +		return ret;
>  
> -	if (wm8978->f_pllout)
> +	if (wm8978->f_pllout) {
>  		/* Switch PLL on */
> -		snd_soc_component_update_bits(component, WM8978_POWER_MANAGEMENT_1, 0x20, 0x20);
> +		ret = snd_soc_component_update_bits(component,
> +						    WM8978_POWER_MANAGEMENT_1,
> +						    0x20, 0x20);
> +		if (ret < 0)
> +			return ret;

What is the thinking on not pushing the bias_level back to off
here?

Thanks,
Charles

      reply	other threads:[~2026-09-07 10:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06  3:43 Pengpeng Hou
2026-09-07 10:47 ` Charles Keepax [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=ap6WRKa1ty7CQSYR@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=hppiscas@163.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --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

all inboxes | Powered by JetHome®