From: sashiko-bot@kernel.org
To: "Kathiravan Thirumoorthy" <kathiravan.thirumoorthy@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 3/3] regulator: qcom-refgen: add support for the IPQ9650 SoC
Date: Wed, 17 Jun 2026 20:44:02 +0000 [thread overview]
Message-ID: <20260617204402.6BF7A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260617-ipq9650_refgen-v4-3-c505ea6c6661@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Unclocked MMIO read in get_status callback causes system crash.
- [Medium] Silent failure on missing clocks due to inadequate DT validation.
--
commit 90356084cf49412e26be88f69da7b99d50c27462
Author: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
regulator: qcom-refgen: add support for the IPQ9650 SoC
This commit adds support for the IPQ9650 SoC to the qcom-refgen regulator
driver. It introduces explicit clock handling for this block and a get_status
callback to report the regulator status.
> diff --git a/drivers/regulator/qcom-refgen-regulator.c b/drivers/regulator/qcom-refgen-regulator.c
> index 6a3795469927e..cc72e5a43ba62 100644
> --- a/drivers/regulator/qcom-refgen-regulator.c
> +++ b/drivers/regulator/qcom-refgen-regulator.c
[ ... ]
> +static int qcom_ipq9650_refgen_disable(struct regulator_dev *rdev)
> +{
> + struct qcom_refgen_drvdata *drvdata = rdev_get_drvdata(rdev);
> +
> + clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
> +
> + drvdata->is_enabled = false;
[Severity: Critical]
Does this disable the clocks before updating the internal state?
If an is_enabled check were added to get_status() to prevent unclocked reads,
could a concurrent call to get_status() still crash the system if it
interleaves after clk_bulk_disable_unprepare() but before is_enabled is
set to false?
> +
> + return 0;
> +}
[ ... ]
> +static int qcom_ipq9650_refgen_get_status(struct regulator_dev *rdev)
> +{
> + u32 val;
> +
> + regmap_read(rdev->regmap, REFGEN_REG_REFGEN_STATUS, &val);
[Severity: Critical]
Can this unclocked MMIO read cause a system crash?
The get_status() callback reads the REFGEN_REG_REFGEN_STATUS register without
ensuring the regulator's clocks are enabled. Since user space can trigger a
read of /sys/class/regulator/regulator.X/status at any time, which invokes
get_status() locklessly, a disabled regulator could cause this regmap_read()
to trigger a synchronous external abort and hang the bus.
> + if (FIELD_GET(REFGEN_STATUS_OUT_MASK, val))
> + return REGULATOR_STATUS_ON;
> +
> + return REGULATOR_STATUS_OFF;
> +}
[ ... ]
> @@ -106,10 +192,23 @@ static int qcom_refgen_probe(struct platform_device *pdev)
[ ... ]
> + if (data->has_clocks) {
> + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> + if (!drvdata)
> + return -ENOMEM;
> +
> + drvdata->num_clks = devm_clk_bulk_get_all(dev, &drvdata->clks);
> + if (drvdata->num_clks < 0)
[Severity: Medium]
Will this silently fail if the clocks are missing from the device tree?
If the clocks property is omitted, devm_clk_bulk_get_all() returns 0.
Since this code only checks for drvdata->num_clks < 0, it treats the missing
clocks as a success, and subsequent calls to clk_bulk_prepare_enable(0, ...)
will silently succeed without enabling any clocks.
Should this explicitly verify drvdata->num_clks > 0 since clocks are mandatory
for the IPQ9650 PHY to function properly?
> + return dev_err_probe(dev, drvdata->num_clks,
> + "failed to get clocks\n");
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260617-ipq9650_refgen-v4-0-c505ea6c6661@oss.qualcomm.com?part=3
prev parent reply other threads:[~2026-06-17 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 17:38 [PATCH v4 0/3] Add support for the REFGEN in the IPQ9650 SoC Kathiravan Thirumoorthy
2026-06-17 17:38 ` [PATCH v4 1/3] regulator: qcom-refgen: correct the regulator type to CURRENT Kathiravan Thirumoorthy
2026-06-17 21:42 ` Dmitry Baryshkov
2026-06-17 17:38 ` [PATCH v4 2/3] regulator: dt-bindings: qcom,sdm845-refgen-regulator: Document IPQ9650 Kathiravan Thirumoorthy
2026-06-17 17:38 ` [PATCH v4 3/3] regulator: qcom-refgen: add support for the IPQ9650 SoC Kathiravan Thirumoorthy
2026-06-17 20:44 ` 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=20260617204402.6BF7A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kathiravan.thirumoorthy@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@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