From: sashiko-bot@kernel.org
To: "Paul Sajna" <sajattack@postmarketos.org>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
lee@kernel.org, linux-leds@vger.kernel.org
Subject: Re: [PATCH v2 6/7] leds: aw2013: Prevent writes to unpowered chip
Date: Tue, 06 Oct 2026 03:59:08 +0000 [thread overview]
Message-ID: <20261006035908.932F71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261005-aw2013-aw20xx-rename-v2-6-108ecbdf2775@postmarketos.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] leds: aw2013: unnecessary power cycle when setting brightness to 0
- [Medium] leds: aw2013: regulator leak on I2C error during turn-off
--
commit f162a4969ac4532fe0ad6e583070bbdf610e7263
Author: Paul Sajna <sajattack@postmarketos.org>
leds: aw2013: Prevent writes to unpowered chip
This commit replaces the chip_in_use check with a chip->enabled boolean
evaluation in aw20xx_brightness_set(). It aims to prevent the driver from
unconditionally calling I2C transactions to an unpowered chip when the LED
core initializes the brightness to 0 during probe, teardown, or
unregistration.
> diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c
> --- a/drivers/leds/leds-aw2013.c
> +++ b/drivers/leds/leds-aw2013.c
> @@ -257,7 +257,7 @@ static int aw20xx_brightness_set(struct led_classdev *cdev,
>
> mutex_lock(&led->chip->mutex);
>
> - if (aw20xx_chip_in_use(led->chip)) {
> + if (!led->chip->enabled) {
> ret = aw20xx_chip_enable(led->chip);
> if (ret)
> goto error;
> }
[Severity: Medium]
Does this introduce an unnecessary power cycle when the brightness is set to 0?
By unconditionally enabling the chip if it is currently disabled, the
driver will incur the performance penalty of powering up regulators and
performing I2C initialization, only to immediately write a 0 and power
down again. This happens during probe, teardown, or when userspace writes
0 to an already off LED.
[ ... ]
> num = led->num;
>
> ret = regmap_write(led->chip->regmap, AW20XX_REG_PWM(num), brightness);
> if (ret)
> goto error;
[Severity: Medium]
Does this leak the regulator enable if the I2C write fails?
If the chip was previously unpowered and was just enabled by the new
check above, an I2C failure here jumps directly to the error label:
aw20xx_brightness_set()
...
error:
mutex_unlock(&led->chip->mutex);
return ret;
This bypasses aw20xx_chip_disable(), leaving the regulators permanently
enabled despite the LED logically being off.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261005-aw2013-aw20xx-rename-v2-0-108ecbdf2775@postmarketos.org?part=6
next prev parent reply other threads:[~2026-10-06 3:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 3:46 [PATCH v2 0/7] leds: aw2013: Add AW2027 support Paul Sajna
2026-10-06 3:46 ` [PATCH v2 1/7] dt-bindings: leds: aw2013: Add awinic,aw2027 compatible Paul Sajna
2026-10-06 3:48 ` sashiko-bot
2026-10-07 10:30 ` Conor Dooley
2026-10-06 3:46 ` [PATCH v2 2/7] leds: aw2013: Rename internal APIs from aw2013 to aw20xx Paul Sajna
2026-10-06 3:56 ` sashiko-bot
2026-10-06 10:45 ` Griffin Kroah-Hartman
2026-10-06 18:54 ` Paul Sajna
2026-10-06 3:46 ` [PATCH v2 3/7] leds: aw2013: Add AW2027 support Paul Sajna
2026-10-06 3:56 ` sashiko-bot
2026-10-06 3:46 ` [PATCH v2 4/7] leds: aw2013: use dev_err_probe Paul Sajna
2026-10-06 3:57 ` sashiko-bot
2026-10-06 19:52 ` Griffin Kroah-Hartman
2026-10-07 7:36 ` Andreas Kemnade
2026-10-06 3:46 ` [PATCH v2 5/7] leds: aw2013: Move assignment of chip->num_leds Paul Sajna
2026-10-06 4:01 ` sashiko-bot
2026-10-06 3:46 ` [PATCH v2 6/7] leds: aw2013: Prevent writes to unpowered chip Paul Sajna
2026-10-06 3:59 ` sashiko-bot [this message]
2026-10-06 3:46 ` [PATCH v2 7/7] leds: aw2013: move reset from probe_dt to chip_init Paul Sajna
2026-10-06 4:00 ` 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=20261006035908.932F71F000FF@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