All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/4] leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak
Date: Tue, 17 Nov 2026 09:46:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-218519@kernel.org> (raw)
In-Reply-To: <20261117-led-qcom-leds-multiple-fixes-and-pwm-fm-support-v1-1-7a862240683f@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] leds: rgb: leds-qcom-lpg: single-entry LUT still treated as
  no pattern
--

commit 75c60a80d1268626e9de041f3218e5d2d8274c04
Author: Fenglin Wu <fenglin.wu@oss.qualcomm.com>

leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak

This commit adds a has_lut flag to struct lpg_channel to track LUT
ownership separately from the pattern index range so that single-entry
LUT allocations are freed when clearing a pattern.

> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 24ffe079f2215..e14a3316bf221 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
[ ... ]
> @@ -1118,6 +1124,8 @@ static int lpg_pattern_set(struct lpg_led *led, struct led_pattern *led_pattern,
>  
>  		chan->pattern_lo_idx = lo_idx;
>  		chan->pattern_hi_idx = hi_idx;
> +		/* The 1st channel owns the LUT while other channels share it */
> +		chan->has_lut = i == 0;
>  	}

[Severity: Medium]
Can a 2-step palindrome pattern actually run when ping_pong compresses
it to a single LUT entry with lo_idx == hi_idx?

Although lpg_lut_free() now checks chan->has_lut, the pattern activation
paths still check whether chan->pattern_lo_idx != chan->pattern_hi_idx:

drivers/leds/rgb/leds-qcom-lpg.c:lpg_brightness_set() {
    ...
		if (brightness == LED_OFF) {
			chan->enabled = false;
			chan->ramp_enabled = false;
		} else if (chan->pattern_lo_idx != chan->pattern_hi_idx) {
    ...
}

lpg_apply_control() and lpg_apply_lut_control() check the same condition,
so a single-entry LUT never enables the ramp generator and falls back to
static full-brightness PWM output.  In addition, the comment earlier in
lpg_pattern_set() notes that a pattern of length 1 causes the hardware
to iterate through the entire LUT, suggesting ping_pong compression
should not reduce a 2-step pattern to actual_len == 1 in the first place.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-led-qcom-leds-multiple-fixes-and-pwm-fm-support-v1-0-7a862240683f@oss.qualcomm.com?part=1

  reply	other threads:[~2026-11-17  9:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:31 [PATCH 0/4] leds: leds-qcom-lpg: Add several fixes and the PWM frequency mode support Fenglin Wu
2026-11-17  9:31 ` [PATCH 1/4] leds: rgb: leds-qcom-lpg: Fix single-entry LUT leak Fenglin Wu
2026-11-17  9:46   ` sashiko-bot [this message]
2026-11-17  9:31 ` [PATCH 2/4] leds: rgb: leds-qcom-lpg: Fix LED color balancing in HW pattern mode Fenglin Wu
2026-11-17  9:50   ` sashiko-bot
2026-11-17  9:31 ` [PATCH 3/4] leds: rgb: leds-qcom-lpg: add mutex lock in lpg_pwm_get_state() Fenglin Wu
2026-11-17  9:40   ` sashiko-bot
2026-11-17  9:31 ` [PATCH 4/4] leds: rgb: leds-qcom-lpg: Add PWM frequency mode support Fenglin Wu
2026-11-17  9:51   ` 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-218519@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.