Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Sajna" <sajattack@postmarketos.org>
Cc: devicetree@vger.kernel.org, lee@kernel.org, robh@kernel.org,
	linux-leds@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC 2/3] leds: aw2013: Rename to aw20xx
Date: Mon, 07 Sep 2026 23:57:41 +0000	[thread overview]
Message-ID: <20260907235741.BBAE61F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907-aw2013-aw20xx-rename-v1-2-c9a7df12a701@postmarketos.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] I2C writes are sent to an unpowered chip when turning off an already disabled LED during teardown, probe, or unregistration.
--

commit 61355e5955755b194e075840a94eea7f1c7e4fa1
Author: Paul Sajna <sajattack@postmarketos.org>
Date:   Mon Sep 7 23:47:52 2026 +0000

    leds: aw2013: Rename to aw20xx
    
    I had to split this into a separate commit for git to properly detect
    this as a rename rather than remove/add. Next commit will add another
    chip to justify the rename.
    
    Includes update of Makefile, Kconfig, Kconfig help, and raw leds-aw2013.c
    rename.
    
    Signed-off-by: Paul Sajna <sajattack@postmarketos.org>

[ ... ]

> diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw20xx.c
> similarity index 100%
> rename from drivers/leds/leds-aw2013.c
> rename to drivers/leds/leds-aw20xx.c

[Severity: High]
This isn't a bug introduced by this patch, but is it possible that I2C writes
are sent to an unpowered chip when turning off an already disabled LED?

During teardown, probe, or unregistration, the LED core initializes
cdev->brightness to 0 and queues a work to set the brightness to 0. This can
also be triggered by unprivileged user space via sysfs by writing 0 to the
brightness file when already 0.

When this occurs, aw2013_chip_in_use() evaluates to false and skips enabling
the regulators:

drivers/leds/leds-aw20xx.c:aw2013_brightness_set() {
    ...
	if (aw2013_chip_in_use(led->chip)) {
		ret = aw2013_chip_enable(led->chip);
		if (ret)
			goto error;
	}

	num = led->num;

	ret = regmap_write(led->chip->regmap, AW2013_REG_PWM(num), brightness);
    ...
}

Because aw2013_chip_enable() is skipped, the driver then unconditionally
calls regmap_write() and regmap_update_bits(), which perform I2C
transactions to the unpowered chip.

Could writing to an unpowered I2C device clamp the SDA/SCL lines to ground
via the chip's internal ESD diodes, hanging the entire I2C bus and making
all other devices on the bus unusable?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907-aw2013-aw20xx-rename-v1-0-c9a7df12a701@postmarketos.org?part=2

  reply	other threads:[~2026-09-07 23:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 23:47 [PATCH RFC 0/3] leds: aw2013: Rename aw2013 to aw20xx and add AW2027 support Paul Sajna
2026-09-07 23:47 ` [PATCH RFC 1/3] dt-bindings: leds: aw2013: Add aw2027 compatible and rename to aw20xx Paul Sajna
2026-09-07 23:52   ` sashiko-bot
2026-09-08 18:03   ` Conor Dooley
2026-09-07 23:47 ` [PATCH RFC 2/3] leds: aw2013: Rename " Paul Sajna
2026-09-07 23:57   ` sashiko-bot [this message]
2026-09-07 23:47 ` [PATCH RFC 3/3] leds: aw2013: Add AW2027 support and rename " Paul Sajna
2026-09-08  0:01   ` sashiko-bot
2026-09-09 16:02     ` Lee Jones

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=20260907235741.BBAE61F00A3A@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=robh@kernel.org \
    --cc=sajattack@postmarketos.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