From: sashiko-bot@kernel.org
To: "Fenglin Wu" <fenglin.wu@oss.qualcomm.com>
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH v2 1/4] leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak
Date: Mon, 23 Nov 2026 06:43:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-228777@kernel.org> (raw)
In-Reply-To: <20261122-led-qcom-leds-multiple-fixes-and-pwm-fm-support-v2-1-2e885f60fbeb@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] leds: rgb: leds-qcom-lpg: broken 1-entry LUT and hi_pause in
lpg_pattern_set()
--
commit 08fbbc17e523563ad041317b9d25935cac2226e0
Author: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak
This commit adds a has_lut boolean to struct lpg_channel so single-entry
LUT allocations where pattern_lo_idx equals pattern_hi_idx are properly
tracked and freed in lpg->lut_bitmap.
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 24ffe079f2215..5d0d015d67e78 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
[ ... ]
> @@ -668,7 +674,7 @@ static void lpg_apply_lut_control(struct lpg_channel *chan)
> unsigned int hi_idx = chan->pattern_hi_idx;
> u16 step = chan->ramp_tick_ms;
>
> - if (!chan->ramp_enabled || chan->pattern_lo_idx == chan->pattern_hi_idx)
> + if (!chan->ramp_enabled || !chan->has_lut)
> return;
>
> hi_pause = DIV_ROUND_UP(chan->ramp_hi_pause_ms, step);
> @@ -709,7 +715,7 @@ static void lpg_apply_control(struct lpg_channel *chan)
> if (chan->enabled)
> ctrl |= LPG_ENABLE_CONTROL_OUTPUT;
>
> - if (chan->pattern_lo_idx != chan->pattern_hi_idx)
> + if (chan->has_lut)
> ctrl |= LPG_ENABLE_CONTROL_RAMP_GEN;
> else
> ctrl |= LPG_ENABLE_CONTROL_SRC_PWM;
[Severity: Medium]
Does enabling the ramp generator when pattern_lo_idx == pattern_hi_idx
cause the hardware to iterate across the entire LUT on a 2-step
palindrome pattern?
In lpg_pattern_set(), a 1-entry LUT pattern is explicitly prohibited for
that reason, but the check runs before ping-pong compression halves a
2-step palindrome (len == 2) down to actual_len == 1:
drivers/leds/rgb/leds-qcom-lpg.c:lpg_pattern_set() {
...
/*
* Specifying a pattern of length 1 causes the hardware to iterate
* through the entire LUT, so prohibit this.
*/
if (len < 2)
goto out_free_pattern;
...
/* The pattern length to be written to the LUT */
if (ping_pong)
actual_len = (len + 1) / 2;
else
actual_len = len;
...
if (lpg->lut_base || lpg->lut_sdam) {
lo_pause = pattern[0].delta_t;
hi_pause = pattern[actual_len - 1].delta_t;
...
}
Previously, the pattern_lo_idx != pattern_hi_idx checks prevented
programming LPG_LO_IDX_REG == LPG_HI_IDX_REG and enabling
LPG_ENABLE_CONTROL_RAMP_GEN when actual_len == 1. With chan->has_lut
replacing those checks, a 2-step palindrome now programs a 1-entry LUT
range into the ramp generator, and also sets hi_pause from
pattern[0].delta_t instead of pattern[1].delta_t.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122-led-qcom-leds-multiple-fixes-and-pwm-fm-support-v2-0-2e885f60fbeb@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-11-23 6:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 6:28 [PATCH v2 0/4] leds: leds-qcom-lpg: Add several fixes and the PWM frequency mode support Fenglin Wu
2026-11-23 6:28 ` [PATCH v2 1/4] leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak Fenglin Wu
2026-11-23 6:43 ` sashiko-bot [this message]
2026-11-23 6:28 ` [PATCH v2 2/4] leds: rgb: leds-qcom-lpg: Fix LED color balancing in HW pattern mode Fenglin Wu
2026-11-23 6:28 ` [PATCH v2 3/4] leds: rgb: leds-qcom-lpg: Add mutex lock in lpg_pwm_get_state() Fenglin Wu
2026-11-23 6:28 ` [PATCH v2 4/4] leds: rgb: leds-qcom-lpg: Add PWM frequency mode support Fenglin Wu
2026-11-23 6:43 ` [PATCH v2 0/4] leds: leds-qcom-lpg: Add several fixes and the " 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=sashiko-outbox-228777@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fenglin.wu@oss.qualcomm.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.