Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ilya Muhamadeev" <nicourced@altlinux.org>, linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: es8316: Allow more time for headset mic bias to settle
Date: Tue, 10 Nov 2026 15:03:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-207223@kernel.org> (raw)
In-Reply-To: <20261110145835.106381-1-nicourced@altlinux.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] ASoC: es8316: uninitialized variable read in es8316_irq() [1]
--

commit 83fd03ee6536ad322b774377b945917b625ffca5
Author: Ilya Muhamadeev <nicourced@altlinux.org>

ASoC: es8316: Allow more time for headset mic bias to settle

This commit increases the settling delay in
es8316_enable_micbias_for_mic_gnd_short_detect() from 20 ms to 100 ms so
that ES8316_GPIO_FLAG_GM_NOT_SHORTED settles before jack detection reads
ES8316_GPIO_FLAG.

> diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
> index 334ac9119c18f..470c503010fc1 100644
> --- a/sound/soc/codecs/es8316.c
> +++ b/sound/soc/codecs/es8316.c
> @@ -616,7 +616,7 @@ static void es8316_enable_micbias_for_mic_gnd_short_detect(
>  	snd_soc_dapm_sync_unlocked(dapm);
>  	snd_soc_dapm_mutex_unlock(dapm);
>  
> -	msleep(20);
> +	msleep(100);
>  }

[Severity: Medium]
This problem wasn't introduced by this patch, but can es8316_irq()
evaluate an uninitialized flags variable [1] if regmap_read() fails?

sound/soc/codecs/es8316.c:es8316_irq() {
	...
	unsigned int flags;

	guard(mutex)(&es8316->lock);

	regmap_read(es8316->regmap, ES8316_GPIO_FLAG, &flags);
	if (flags == 0x00)
		return IRQ_HANDLED; /* Powered-down / reset */
	...
	} else if (!(es8316->jack->status & SND_JACK_HEADPHONE)) {
		/* Jack inserted, determine type */
		es8316_enable_micbias_for_mic_gnd_short_detect(comp);
		regmap_read(es8316->regmap, ES8316_GPIO_FLAG, &flags);
		if (es8316->jd_inverted)
			flags ^= ES8316_GPIO_FLAG_HP_NOT_INSERTED;
	...
}

Neither regmap_read() call checks for errors.  If an I2C read fails (or
returns -EBUSY while the regcache is in cache-only mode during resume),
es8316_irq() branches on indeterminate stack data, which can report bogus
jack events to userspace or leave mic bias enabled in the wrong state.

[1] https://sashiko.dev/#/bug/linux-3f2856a8-3cfe-4dc1-bfa0-d15ea515aabd

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110145835.106381-1-nicourced@altlinux.org?part=1

      reply	other threads:[~2026-11-10 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 14:58 [PATCH] ASoC: es8316: Allow more time for headset mic bias to settle Ilya Muhamadeev
2026-11-10 15:03 ` sashiko-bot [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=sashiko-outbox-207223@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicourced@altlinux.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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