From: sashiko-bot@kernel.org
To: "Shashank Maurya" <shashank.maurya@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support
Date: Tue, 22 Sep 2026 15:39:02 +0000 [thread overview]
Message-ID: <20260922153902.C3BEA1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260922-rpi_reg-v3-2-9214321c4070@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] regulator: leaked enable count on vcc regulator during probe failure and unbind
--
commit db1c448e80eee7e671cad78e558097db3e8ec366
Author: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
regulator: rpi-panel-v2: Add vcc-supply support
The Raspberry Pi 7" touchscreen panel V2 MCU is powered from an external
power rail which has to be enabled before any I2C register access is
attempted. This commit uses devm_regulator_get() to obtain the vcc supply
and enable it at the start of probe.
> diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c
> index 30b78aa75ee38..e54d675962e71 100644
> --- a/drivers/regulator/rpi-panel-v2-regulator.c
> +++ b/drivers/regulator/rpi-panel-v2-regulator.c
[ ... ]
> @@ -66,10 +67,21 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
> .parent = &i2c->dev,
> .reg_set_base = REG_POWERON,
> };
> + struct regulator *vcc;
> struct regmap *regmap;
> struct pwm_chip *pc;
> int ret;
>
> + vcc = devm_regulator_get(&i2c->dev, "vcc");
> + if (IS_ERR(vcc))
> + return dev_err_probe(&i2c->dev, PTR_ERR(vcc),
> + "Failed to get vcc supply\n");
> +
> + ret = regulator_enable(vcc);
> + if (ret)
> + return dev_err_probe(&i2c->dev, ret,
> + "Failed to enable vcc supply\n");
[Severity: High]
Could this introduce a regression where a matching regulator_disable() is
missing in rpi_panel_v2_i2c_probe() for subsequent error paths and driver
remove callbacks?
> +
> pc = devm_pwmchip_alloc(&i2c->dev, 1, 0);
> if (IS_ERR(pc))
> return PTR_ERR(pc);
[Severity: High]
If this allocation fails in rpi_panel_v2_i2c_probe(), does the function
return directly and leak the vcc regulator enable count?
The vcc regulator's enable count is incremented via regulator_enable() but
is never decremented. When the driver unbinds or probe fails, devres calls
regulator_put(), which triggers a WARN_ON(regulator->enable_count) and
permanently leaks the underlying regulator device's use count. This prevents
the power rail from ever being physically disabled. On systems with
panic_on_warn, this triggers a kernel panic.
This regression is reachable locally via device unbind, or automatically
during boot if a downstream resource causes a probe deferral.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-rpi_reg-v3-0-9214321c4070@oss.qualcomm.com?part=2
prev parent reply other threads:[~2026-09-22 15:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 15:31 [PATCH v3 0/2] regulator: rpi-panel-v2: Add vcc-supply Shashank Maurya
2026-09-22 15:31 ` [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
2026-09-28 9:35 ` Krzysztof Kozlowski
2026-09-22 15:32 ` [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
2026-09-22 15:39 ` 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=20260922153902.C3BEA1F00893@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=shashank.maurya@oss.qualcomm.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