Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shenghao Ding" <shenghao-ding@ti.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: tas2781: read TAS2573 status registers by entry length
Date: Mon, 30 Nov 2026 06:18:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-240437@kernel.org> (raw)
In-Reply-To: <20261130060944.760-1-shenghao-ding@ti.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: tas2781: wrong 1-byte value offset in
  tas2573_status_get_common()
--

commit b7312ae4413018d2f0f76879de67e7c18a9d032d
Author: Shenghao Ding <shenghao-ding@ti.com>

ASoC: tas2781: read TAS2573 status registers by entry length

This commit replaces the plain register address arrays for TAS2573 status
controls with entry descriptors that specify each register's access width.

> diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
> index 2dbbd13f5e814..f59be9d7ac313 100644
> --- a/sound/soc/codecs/tas2781-i2c.c
> +++ b/sound/soc/codecs/tas2781-i2c.c
[ ... ]
> @@ -1565,40 +1566,45 @@ static int tas2573_status_get_common(struct snd_kcontrol *kcontrol,
[ ... ]
>  	for (j = 0; j < priv->ndev; j++) {
>  		dst[i++] = j;
> -		dst[i++] = 0;
> -		dst[i++] = 0;
> -		dst[i++] = 0;
> -
> -		rc = tasdevice_dev_read(priv, j, map->regs[0], &val);
> -		if (rc < 0)
> -			dev_err(priv->dev,
> -				"chn %d %s[0] rd err = %d\n",
> -				j, map->tag, rc);
> -		else
> -			dst[i++] = val;
> -
> -		for (k = 1; k < map->nregs; k++, i += 4) {
> -			rc = tasdevice_dev_bulk_read(priv, j, map->regs[k],
> -						     &dst[i], 4);
> -			if (rc < 0)
> -				dev_err(priv->dev,
> -					"chn %d %s[%u] bulk_rd err = %d\n",
> -					j, map->tag, k, rc);
> +		for (k = 0; k < map->nentries; k++, i += 4) {
> +			dst[i] = 0;
> +			dst[i + 1] = 0;
> +			dst[i + 2] = 0;
> +			dst[i + 3] = 0;
> +
> +			if (map->entries[k].val_len == 4) {
> +				rc = tasdevice_dev_bulk_read(priv, j,
> +					map->entries[k].reg,  &dst[i], 4);
> +				if (rc < 0)
> +					dev_err(priv->dev,
> +						"chn %d %s[%u] bulk_read err = %d\n",
> +						j, map->tag, k, rc);
> +			} else {
> +				rc = tasdevice_dev_read(priv, j,
> +					map->entries[k].reg, &val);
> +				if (!rc)
> +					dst[i] = val;

[Severity: Medium]
Should the single-byte read branch write to dst[i + 3] instead of dst[i]?
Previously i was post-incremented three times while zeroing the leading
bytes, so val was placed in the fourth byte ({0, 0, 0, val}); writing
dst[i] = val changes the 4-byte slot layout returned to userspace to
{val, 0, 0, 0}.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130060944.760-1-shenghao-ding@ti.com?part=1

      reply	other threads:[~2026-11-30  6:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  6:09 [PATCH v2] ASoC: tas2781: read TAS2573 status registers by entry length Shenghao Ding
2026-11-30  6:18 ` 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-240437@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shenghao-ding@ti.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