Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhang Yi" <zhangyi@everest-semi.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX
Date: Thu, 18 Jun 2026 08:41:05 +0000	[thread overview]
Message-ID: <20260618084106.419321F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618082842.2778-8-zhangyi@everest-semi.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Logic error in get_coeff incorrectly treats 0 as a wildcard for dmic_sel and dvdd_vol, shadowing specific coefficient configurations.
--

commit 6402e3af14ba28c3424e8a95b28fe5d44fa00f37
Author: Zhang Yi <zhangyi@everest-semi.com>

ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX

This commit adds INPUTL MUX and INPUTR MUX to the DAPM routing paths for
the ES8389 codec.

> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index bcec9d9200dbe..294951d49432c 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but looking at get_coeff() in
sound/soc/codecs/es8389.c, is there a logic error with how dmic_sel and
dvdd_vol are checked?

sound/soc/codecs/es8389.c:get_coeff() {
	...
	for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
		if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk) {
			vddd_det = ~(coeff_div[i].dvdd_vol ^ vddd) & 0x01;
			dmic_det = ~(coeff_div[i].dmic_sel ^ dmic) & 0x01;
			vddd_det |= ~(coeff_div[i].dvdd_vol % 2) & 0x01;
			dmic_det |= ~(coeff_div[i].dmic_sel % 2) & 0x01;

			if (vddd_det && dmic_det)
				return i;
		}
	}
	...
}

Because ~(0 % 2) & 0x01 evaluates to 1, doesn't this calculation cause 0 to
act as a wildcard, evaluating to true regardless of the dmic or vddd
parameters?

If entries with dmic_sel = 0 appear before dmic_sel = 1 in the coeff_div
table, could get_coeff() prematurely return the wildcard match?  This appears
to make the correct clock coefficient entries for dmic = 1 dead code,
potentially resulting in incorrect clock configurations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260618082842.2778-1-zhangyi@everest-semi.com?part=7

      reply	other threads:[~2026-06-18  8:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  8:28 [PATCH v2 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-18  8:28 ` [PATCH v2 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
2026-06-18  8:43   ` sashiko-bot
2026-06-18  8:28 ` [PATCH v2 2/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-18  8:45   ` sashiko-bot
2026-06-18  8:28 ` [PATCH v2 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
2026-06-18  8:42   ` sashiko-bot
2026-06-18  8:28 ` [PATCH v2 4/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
2026-06-18  8:28 ` [PATCH v2 5/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
2026-06-18  8:41   ` sashiko-bot
2026-06-18  8:28 ` [PATCH v2 6/7] ASoC: codecs: ES8389: Add private members about HPF Zhang Yi
2026-06-18  8:39   ` sashiko-bot
2026-06-18  8:28 ` [PATCH v2 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
2026-06-18  8:41   ` 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=20260618084106.419321F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhangyi@everest-semi.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