From: sashiko-bot@kernel.org
To: "David Yang" <mmyangfl@gmail.com>, dmaengine@vger.kernel.org
Cc: vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 1/2] dmaengine: pl08x: Release the reset before reading registers
Date: Wed, 04 Nov 2026 15:55:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-197555@kernel.org> (raw)
In-Reply-To: <20261104154542.3131916-2-mmyangfl@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] dmaengine: pl08x: exclusive reset breaks shared resets in pl08x_probe()
- [Medium] dmaengine: pl08x: MMIO mapping leak on reset error in pl08x_probe()
--
commit 5b724fceef572df4410288b36fa49f5ba64ab7da
Author: David Yang <mmyangfl@gmail.com>
dmaengine: pl08x: Release the reset before reading registers
This commit acquires an optional exclusive reset control and deasserts it
in pl08x_probe() before accessing device registers, covering devices whose
device tree nodes specify arm,primecell-periphid and therefore bypass
amba_read_periphid().
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> index 543c2eb8cfa81..33ad6c42cd7fb 100644
> --- a/drivers/dma/amba-pl08x.c
> +++ b/drivers/dma/amba-pl08x.c
[ ... ]
> @@ -2725,6 +2727,16 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
> goto out_no_ioremap;
> }
>
> + /* Release the reset before reading registers */
> + rst = devm_reset_control_get_optional_exclusive(&adev->dev, NULL);
[Severity: High]
Could requesting an exclusive reset control here break platforms where the
PL08x reset line is shared with other peripherals?
In drivers/amba/bus.c, amba_read_periphid() acquires a shared reset control:
rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
On StarFive JH7110 (arch/riscv/boot/dts/starfive/jh7110.dtsi), the PL080 node
sdma (dma-controller@16008000) carries arm,primecell-periphid and shares the
JH7110_STGRST_SEC_AHB reset with crypto@16000000 and rng@1600c000. Both
starfive_cryp_probe() in drivers/crypto/starfive/jh7110-cryp.c and
starfive_trng_probe() in drivers/char/hw_random/jh7110-trng.c request that
reset line via devm_reset_control_get_shared().
When pl08x_probe() calls devm_reset_control_get_optional_exclusive(),
__reset_control_get_internal() in drivers/reset/core.c rejects mixing shared
and exclusive controls on the same reset line:
if (WARN_ON(!rstc->shared || !shared))
return ERR_PTR(-EBUSY);
Additionally, manually calling reset_control_deassert() without a devm action
leaves the reset deasserted if pl08x_probe() fails later or when the driver
is unbound. Would devm_reset_control_get_optional_shared_deasserted() avoid
both issues?
> + if (IS_ERR(rst)) {
> + ret = PTR_ERR(rst);
> + goto out_no_ioremap;
> + }
> + ret = reset_control_deassert(rst);
> + if (ret)
> + goto out_no_ioremap;
[Severity: Medium]
Does jumping to out_no_ioremap here leak the pl08x->base MMIO mapping when
getting or deasserting the reset fails (for example, with -EPROBE_DEFER)?
In pl08x_probe(), pl08x->base has already been mapped via ioremap() right
before this block, while the error cleanup labels at the bottom of
pl08x_probe() are ordered as:
out_no_platdata:
iounmap(pl08x->base);
out_no_ioremap:
kfree(pl08x);
Should these error paths jump to out_no_platdata instead of out_no_ioremap so
that pl08x->base is unmapped?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104154542.3131916-1-mmyangfl@gmail.com?part=1
next prev parent reply other threads:[~2026-11-04 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 15:45 [PATCH 0/2] dmaengine: pl08x: Support the Hi3798MV100 PL080 variant David Yang
2026-11-04 15:45 ` [PATCH 1/2] dmaengine: pl08x: Release the reset before reading registers David Yang
2026-11-04 15:55 ` sashiko-bot [this message]
2026-11-04 15:45 ` [PATCH 2/2] dmaengine: pl08x: Use the channel count from the device tree David Yang
2026-11-04 15:57 ` 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=sashiko-outbox-197555@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=mmyangfl@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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