From: sashiko-bot@kernel.org
To: "Binbin Zhou" <zhoubinbin@loongson.cn>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 3/9] ASoC: loongson: Add Loongson-2K0300 I2S controller support
Date: Fri, 26 Jun 2026 02:37:40 +0000 [thread overview]
Message-ID: <20260626023740.6FB891F000E9@smtp.kernel.org> (raw)
In-Reply-To: <4d3caa62d4275e1495505387198408f4d30d453c.1782439646.git.zhoubinbin@loongson.cn>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] Missing hardware quirk reset sequence on system resume.
- [Medium] Read-Modify-Write on a volatile control register can unintentionally re-enable transient hardware states during soft reset.
Pre-existing issues:
- [High] Illegal overriding of platform device name during probe leading to Use-After-Free and sysfs corruption.
--
commit b9499f3634cc6b7a7bad0f418f80a05c56aa0954
Author: Binbin Zhou <zhoubinbin@loongson.cn>
ASoC: loongson: Add Loongson-2K0300 I2S controller support
The Loongson-2K0300 I2S interface differs significantly from the
Loongson-2K1000. Although both utilize external DMA controllers, the
Loongson-2K0300 does not require additional registers for routing
configuration.
Due to hardware design flaw, an extra controller reset sequence is
required during probe.
> diff --git a/sound/soc/loongson/loongson_i2s_plat.c b/sound/soc/loongson/loongson_i2s_plat.c
> index ac054b6ce6322..82d95c6644ef0 100644
> --- a/sound/soc/loongson/loongson_i2s_plat.c
> +++ b/sound/soc/loongson/loongson_i2s_plat.c
[ ... ]
> @@ -87,11 +108,17 @@ static int loongson_i2s_plat_probe(struct platform_device *pdev)
> if (IS_ERR(i2s_clk))
> return dev_err_probe(dev, PTR_ERR(i2s_clk), "clock property invalid\n");
> i2s->clk_rate = clk_get_rate(i2s_clk);
> + i2s->rev_id = plat_config->rev_id;
>
> dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> dev_set_name(dev, LS_I2S_DRVNAME);
[Severity: High]
This is a pre-existing issue, but does calling dev_set_name() on an already
registered platform device cause a use-after-free?
Calling dev_set_name() here frees the existing kobj->name without renaming
the underlying sysfs directory.
Could this corrupt the kobject state and lead to kernel warnings upon device
removal?
> dev_set_drvdata(dev, i2s);
>
> + if (i2s->rev_id == 1) {
> + regmap_update_bits(i2s->regmap, LS_I2S_CTRL, I2S_CTRL_RESET, I2S_CTRL_RESET);
[Severity: High]
Since this controller requires a reset due to a hardware flaw, does it also
need this reset applied in the resume path?
When the system suspends, power to the controller is typically lost. Upon
resume, the shared i2s_resume() function is called:
sound/soc/loongson/loongson_i2s.c:i2s_resume() {
struct loongson_i2s *i2s = dev_get_drvdata(dev);
regcache_cache_only(i2s->regmap, false);
return regcache_sync(i2s->regmap);
}
Because LS_I2S_CTRL is typically a volatile register, regcache_sync() will
not automatically restore it. Will this leave the hardware design flaw
unmitigated after a suspend/resume cycle?
[Severity: Medium]
Does using regmap_update_bits() on a volatile control register risk
preserving unintended active states during the soft reset?
Since this performs a read-modify-write, if the bootloader or previous
uninitialized state left other functional bits active, they might be
logically preserved and kept enabled during the reset sequence.
Would it be safer to use regmap_write() to assert the reset while explicitly
ensuring all other functional bits are zeroed out?
> + fsleep(200);
> + }
> +
> ret = devm_snd_soc_register_component(dev, &loongson_i2s_edma_component,
> &loongson_i2s_dai, 1);
> if (ret)
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1782439646.git.zhoubinbin@loongson.cn?part=3
next prev parent reply other threads:[~2026-06-26 2:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 2:27 [PATCH v3 0/9] ASoC: Add Loongson-2K0300 I2S controller and sound card support Binbin Zhou
2026-06-26 2:27 ` [PATCH v3 1/9] ASoC: loongson: Fix error handling in ACPI property parsing Binbin Zhou
2026-06-26 2:38 ` sashiko-bot
2026-06-26 2:27 ` [PATCH v3 2/9] ASoC: dt-bindings: loongson,ls2k1000-i2s: Document Loongson-2K0300 compatible Binbin Zhou
2026-06-26 2:27 ` [PATCH v3 3/9] ASoC: loongson: Add Loongson-2K0300 I2S controller support Binbin Zhou
2026-06-26 2:37 ` sashiko-bot [this message]
2026-06-26 2:27 ` [PATCH v3 4/9] ASoC: dt-bindings: loongson,ls-audio-card: Use common sound card Binbin Zhou
2026-06-26 2:37 ` sashiko-bot
2026-06-26 2:27 ` [PATCH v3 5/9] ASoC: dt-bindings: loongson,ls-audio-card: Add ctcisz forever pi compatible Binbin Zhou
2026-06-26 8:39 ` Krzysztof Kozlowski
2026-06-26 2:27 ` [PATCH v3 6/9] ASoC: loongson: Add Loongson-2K0300 CTCISZ Forever Pi sound card support Binbin Zhou
2026-06-26 2:38 ` sashiko-bot
2026-06-26 2:27 ` [PATCH v3 7/9] ASoC: dt-bindings: loongson,ls-audio-card: Add ATK-DL2K0300B compatible Binbin Zhou
2026-06-26 2:38 ` sashiko-bot
2026-06-26 2:27 ` [PATCH v3 8/9] ASoC: loongson: Add headphone jack detection and DAPM routing Binbin Zhou
2026-06-26 2:44 ` sashiko-bot
2026-06-26 2:27 ` [PATCH v3 9/9] ASoC: es8328: Add DAPM routes from MIC inputs to Mic Bias Binbin Zhou
2026-06-26 2:40 ` sashiko-bot
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=20260626023740.6FB891F000E9@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=zhoubinbin@loongson.cn \
/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