Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shashank Maurya" <shashank.maurya@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/2] regulator: rpi-panel-v2: Add vcc-supply support
Date: Wed, 04 Nov 2026 08:16:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-196869@kernel.org> (raw)
In-Reply-To: <20261104-rpi_reg-v4-2-3578e794ff45@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] regulator: rpi-panel-v2: leaked enable count in rpi_panel_v2_i2c_probe()
--

commit e10aa8754cb62ec300b893710f2607ab6d8e3548
Author: Shashank Maurya <shashank.maurya@oss.qualcomm.com>

regulator: rpi-panel-v2: Add vcc-supply support

This commit adds support for acquiring and enabling the vcc power supply in
rpi_panel_v2_i2c_probe() before accessing the panel MCU over I2C.

> 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]
As reported by Sashiko on v2 [1], does this leak the vcc regulator enable
count when a subsequent call in rpi_panel_v2_i2c_probe() fails (such as
devm_pwmchip_alloc(), devm_regmap_init_i2c(), devm_gpio_regmap_register(), or
devm_pwmchip_add()), or when the driver is unbound?

Because vcc is acquired with devm_regulator_get() and enabled with an
unmanaged regulator_enable(), devres cleanup calls:

  devm_regulator_release()
    -> regulator_put()
      -> _regulator_put()

while regulator->enable_count is still 1, triggering
WARN_ON(regulator->enable_count) in _regulator_put() and leaving the
underlying regulator_dev use_count permanently elevated.

Should rpi_panel_v2_i2c_probe() use devm_regulator_get_enable(&i2c->dev,
"vcc") instead so that a devm action is registered to disable the supply
before releasing it?

[1] https://lore.kernel.org/r/20260907055129.010E71F00A3A@smtp.kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-rpi_reg-v4-0-3578e794ff45@oss.qualcomm.com?part=2

  reply	other threads:[~2026-11-04  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  8:10 [PATCH v4 0/2] regulator: rpi-panel-v2: Add vcc-supply Shashank Maurya
2026-11-04  8:10 ` [PATCH v4 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
2026-11-04 17:05   ` Rob Herring
2026-11-04  8:10 ` [PATCH v4 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
2026-11-04  8:16   ` sashiko-bot [this message]
2026-11-04 13:23   ` Mark Brown

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-196869@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