Thread (9 messages) flat view 9 messages, 4 authors, 14h ago

Re: [PATCH RFC 2/3] leds: aw2013: Rename to aw20xx

From: sashiko-bot@kernel.org
Date: 2026-09-07 23:57:42
Also in: linux-leds

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 [off-list ref]
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 [off-list ref]

[ ... ]
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help