From: sashiko-bot@kernel.org
To: "Michal Piekos" <michal.piekos@mmpsystems.pl>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
krzk+dt@kernel.org
Subject: Re: [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support
Date: Mon, 11 May 2026 21:15:54 +0000 [thread overview]
Message-ID: <20260511211554.CE893C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260510-sunxi-a523-gpadc-v1-2-4f6b0f4000fb@mmpsystems.pl>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing validation for 0 clocks returned by devm_clk_bulk_get_all_enabled() leading to a kernel panic on register access.
--
commit daf3632321b60ce8511b98ae1ad1e4b009e48e3c
Author: Michal Piekos <michal.piekos@mmpsystems.pl>
iio: adc: sun20i-gpadc: add A523 gpadc support
This commit adds support for the A523 gpadc by switching from a single
clock initialization to using devm_clk_bulk_get_all_enabled() to handle
both the bus and module clocks.
> diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
> index 861c14da75add..dd4c7e6e3d76e 100644
> --- a/drivers/iio/adc/sun20i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun20i-gpadc-iio.c
[ ... ]
> @@ -205,9 +205,9 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> if (IS_ERR(info->regs))
> return PTR_ERR(info->regs);
>
> - clk = devm_clk_get_enabled(dev, NULL);
> - if (IS_ERR(clk))
> - return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
> + ret = devm_clk_bulk_get_all_enabled(dev, &clks);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "failed to enable clocks\n");
If the device tree node lacks clock definitions,
devm_clk_bulk_get_all_enabled() will return 0. Because this error handling
only checks for negative return values, could this allow the driver probe
to proceed with zero clocks enabled?
On Allwinner hardware, accessing the registers of an unclocked IP block
typically triggers a synchronous external abort or bus fault. If ret is 0,
the probe later performs a register write:
sun20i_gpadc_probe() {
...
writel(FIELD_PREP(SUN20I_GPADC_CTRL_ADC_AUTOCALI_EN_MASK, 1) |
FIELD_PREP(SUN20I_GPADC_CTRL_WORK_MODE_MASK, SUN20I_GPADC_WORK_MODE_SINGLE),
info->regs + SUN20I_GPADC_CTRL);
...
}
Should we also verify that the number of clocks returned is greater than
zero to prevent a potential panic during the register configuration?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260510-sunxi-a523-gpadc-v1-0-4f6b0f4000fb@mmpsystems.pl?part=2
next prev parent reply other threads:[~2026-05-11 21:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 12:57 [PATCH 0/3] Add GPADC support for A523 Michal Piekos
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
2026-05-10 14:29 ` Rob Herring (Arm)
2026-05-10 14:40 ` Jernej Škrabec
2026-05-11 16:02 ` Andre Przywara
2026-05-12 3:56 ` Michal Piekos
2026-05-11 20:57 ` sashiko-bot
2026-05-10 12:57 ` [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Michal Piekos
2026-05-11 21:15 ` sashiko-bot [this message]
2026-05-12 11:51 ` Jonathan Cameron
2026-05-12 13:48 ` Andre Przywara
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
2026-05-10 14:39 ` Jernej Škrabec
2026-05-10 18:34 ` Chen-Yu Tsai
2026-05-11 21:30 ` 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=20260511211554.CE893C2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=michal.piekos@mmpsystems.pl \
--cc=robh@kernel.org \
--cc=sashiko@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