Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christoph Rudorff" <chris@rudorff.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/3] iio: light: Update DT bindings for GP2AP002
Date: Fri, 16 Oct 2026 14:49:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-174490@kernel.org> (raw)
In-Reply-To: <20261016-iio-light-gp2ap002-v1-2-7c93312fa8d5@rudorff.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: gp2ap002: vled regulator leak in error paths
--

commit 999604192c18f52748ad72ac0d26233473334acf
Author: Christoph Rudorff <chris@rudorff.com>

iio: light: Update DT bindings for GP2AP002

This commit adds the missing vled-supply regulator to the device tree
bindings for the Sharp GP2AP002 sensor.

> diff --git a/Documentation/devicetree/bindings/iio/light/sharp,gp2ap002.yaml b/Documentation/devicetree/bindings/iio/light/sharp,gp2ap002.yaml
> index 99bddf31cbed2..2b5025043168a 100644
> --- a/Documentation/devicetree/bindings/iio/light/sharp,gp2ap002.yaml
> +++ b/Documentation/devicetree/bindings/iio/light/sharp,gp2ap002.yaml
> @@ -33,6 +33,9 @@ properties:
>    vio-supply:
>      description: VIO power supply a phandle to a regulator
>  
> +  vled-supply:
> +    description: LED power supply a phandle to a regulator
> +
>    io-channels:
>      maxItems: 1
>      description: ALSOUT ADC channel to read the ambient light

While reviewing this binding addition, I noticed the corresponding driver
code might be missing cleanup for this regulator.

drivers/iio/light/gp2ap002.c:gp2ap002_probe() {
...
	ret = regulator_enable(gp2ap002->vled);
	if (ret) {
		dev_err(dev, "failed to enable VLED regulator\n");
		goto out_disable_vio;
	}

	msleep(20);

	/*
	 * Initialize the device and signal to runtime PM that now we are
	 * definitely up and using power.
	 */
	ret = gp2ap002_init(gp2ap002);
	if (ret) {
		dev_err(dev, "initialization failed\n");
		goto out_disable_vio;
	}
...
out_disable_vio:
	regulator_disable(gp2ap002->vio);
out_disable_vdd:
	regulator_disable(gp2ap002->vdd);
	return ret;
}

[Severity: Medium]
Does this code leak the vled regulator? If initialization fails, the error path
jumps to out_disable_vio, completely skipping the disablement of vled and
leaving it indefinitely enabled.

The same sequence appears during runtime resume:

drivers/iio/light/gp2ap002.c:gp2ap002_runtime_resume() {
...
	ret = regulator_enable(gp2ap002->vled);
	if (ret) {
		dev_err(dev, "failed to enable VLED regulator in resume path\n");
		goto out_disable_vio;
	}

	msleep(20);

	ret = gp2ap002_init(gp2ap002);
	if (ret) {
		dev_err(dev, "re-initialization failed\n");
		goto out_disable_vio;
	}
...
out_disable_vio:
	regulator_disable(gp2ap002->vio);
out_disable_vdd:
	regulator_disable(gp2ap002->vdd);
	return ret;
}

[Severity: Medium]
Does this code similarly leak the vled regulator during a resume failure?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-iio-light-gp2ap002-v1-0-7c93312fa8d5@rudorff.com?part=2

  parent reply	other threads:[~2026-10-16 14:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 14:43 [PATCH 0/3] from my MSM8916-mainline: Christoph Rudorff
2026-10-16 14:43 ` [PATCH 1/3] iio: light: gp2ap002: add led power supply Christoph Rudorff
2026-10-16 14:48   ` sashiko-bot
2026-10-17  0:05   ` Jonathan Cameron
2026-10-16 14:43 ` [PATCH 2/3] iio: light: Update DT bindings for GP2AP002 Christoph Rudorff
2026-10-16 14:45   ` Krzysztof Kozlowski
2026-10-16 14:58     ` chr[]
2026-10-16 14:49   ` sashiko-bot [this message]
2026-10-16 21:01   ` Linus Walleij
2026-10-17  9:18     ` chr[]
2026-10-16 14:43 ` [PATCH 3/3] arm64: dts: qcom: msm8916-samsung-j5: Add proximity sensor Christoph Rudorff
2026-10-16 15:11   ` Konrad Dybcio

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-174490@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chris@rudorff.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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