Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nora Schiffer" <nora.schiffer@ew.tq-group.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	linux-leds@vger.kernel.org, conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v4 08/10] leds: pca995x: Add sysfs files for error reporting
Date: Wed, 30 Sep 2026 15:48:23 +0000	[thread overview]
Message-ID: <20260930154824.5083C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <3232b9b6f3574b19082281c0d03873e80bc8e2e5.1790684839.git.nora.schiffer@ew.tq-group.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] leds: pca995x: unintentional overwrite of MODE2 register during probe
--

commit 1bf2389241c12cac5965e7df3db32ae52db81482
Author: Nora Schiffer <nora.schiffer@ew.tq-group.com>

leds: pca995x: Add sysfs files for error reporting

The PCA995x has builtin failure detection. Provide sysfs files for
individual LED status (reporting "okay", "short-circuit" or
"open-circuit") as well as a global "has_errors" flag. has_errors is
sticky and must be cleared by writing "clear" to the sysfs file.

> diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c
> index df3f7ab2e1f87..1fc8de5a77bbc 100644
> --- a/drivers/leds/leds-pca995x.c
> +++ b/drivers/leds/leds-pca995x.c
[ ... ]
> @@ -185,11 +279,20 @@ static int pca995x_probe(struct i2c_client *client)
>  	if (ret)
>  		goto err_put_nodes;
>  
> +	/* Clear errors on probe */
> +	ret = regmap_write(chip->regmap, PCA995X_MODE2, PCA995X_MODE2_CFG);

[Severity: High]
Does this unconditional write clobber the entire MODE2 register?

Using regmap_write() instead of regmap_update_bits() zeroes out all other
bits in the MODE2 register.

This clobbers the power-on reset defaults of the hardware, specifically the
OUTDRV bit (typically bit 2), which defaults to 1 (totem-pole output).

Clearing it changes the output driver to open-drain, which can cause the
LEDs to fail to light up or behave erratically.

Could regmap_update_bits() be used here instead to only set the CLRERR bit,
similar to how it is handled in has_errors_store()?

> +	if (ret)
> +		goto err_put_nodes;
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790684839.git.nora.schiffer@ew.tq-group.com?part=8

  reply	other threads:[~2026-09-30 15:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 14:25 [PATCH v4 00/10] leds: pca995x: Minor fixes; reset, output-gain, error reporting and group brightness support Nora Schiffer
2026-09-30 14:25 ` [PATCH v4 01/10] dt-bindings: leds: pca995x: Describe reset-gpios property Nora Schiffer
2026-09-30 15:02   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 02/10] dt-bindings: leds: pca995x: Describe nxp,output-gain property Nora Schiffer
2026-09-30 15:09   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 03/10] leds: pca995x: Fix maximum LED index for 16-channel variants Nora Schiffer
2026-09-30 14:58   ` Griffin Kroah-Hartman
2026-09-30 15:15   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 04/10] leds: pca995x: Fix fwnode handle leaks in error paths Nora Schiffer
2026-09-30 15:24   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 05/10] leds: pca995x: Write global registers before creating LED devices Nora Schiffer
2026-09-30 15:33   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 06/10] leds: pca995x: Add support for reset GPIO Nora Schiffer
2026-09-30 15:37   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 07/10] leds: pca995x: Make output gain configurable Nora Schiffer
2026-09-30 15:41   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 08/10] leds: pca995x: Add sysfs files for error reporting Nora Schiffer
2026-09-30 15:48   ` sashiko-bot [this message]
2026-10-01  8:03     ` Nora Schiffer
2026-09-30 14:25 ` [PATCH v4 09/10] leds: pca995x: Do not use full on LED mode Nora Schiffer
2026-09-30 15:54   ` sashiko-bot
2026-09-30 14:25 ` [PATCH v4 10/10] leds: pca995x: Add support for group brightness control Nora Schiffer
2026-09-30 16:03   ` 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=20260930154824.5083C1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=nora.schiffer@ew.tq-group.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