All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/3] backlight: qcom-wled: Fix WLED3 brightness register stride
Date: Mon, 14 Sep 2026 17:50:40 +0000	[thread overview]
Message-ID: <20260914175041.25D701F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914-qcom-wled-backlight-v2-1-a908d9233e93@ixit.cz>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch incorrectly implements a 16-byte stride for WLED3 brightness registers instead of the intended 2-byte stride, causing register collision and corruption.
--

commit f7a2ef410d595586ca0ef2c87637e54f23dec1e2
Author: David Heidelberg <david@ixit.cz>
Subject: backlight: qcom-wled: Fix WLED3 brightness register stride

This commit aims to fix an overlapping brightness register write issue in the
WLED3 driver. It modifies the WLED3_SINK_REG_BRIGHT macro to update the
register stride for consecutive strings. The commit message states the intent
is to use a 2-byte stride.

> diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
> index 650dd95f06ef5..22c35da72dce3 100644
> --- a/drivers/video/backlight/qcom-wled.c
> +++ b/drivers/video/backlight/qcom-wled.c
> @@ -59,7 +59,7 @@
>  #define  WLED3_SINK_REG_CURR_SINK_SHFT			5
>  
>  /* WLED3 specific per-'string' registers below */
> -#define WLED3_SINK_REG_BRIGHT(n)			(0x40 + n)
> +#define WLED3_SINK_REG_BRIGHT(n)			(0x40 + (n * 0x10))

[Severity: High]
Does this code incorrectly implement a 16-byte stride instead of the intended
2-byte stride?

The commit message states "Use the 2 byte stride.", but the macro evaluates to
a 16-byte stride (n * 0x10) instead of a mathematically sound 2-byte stride
(n * 2).

When wled3_set_brightness() evaluates this macro and passes it to
regmap_bulk_write():

drivers/video/backlight/qcom-wled.c:wled3_set_brightness() {
    ...
		rc = regmap_bulk_write(wled->regmap, wled->ctrl_addr +
				       WLED3_SINK_REG_BRIGHT(wled->cfg.enabled_strings[i]),
				       &v, sizeof(v));
    ...
}

Writing 2 bytes to WLED3_SINK_REG_BRIGHT(2) calculates the address as
0x40 + 0x20 = 0x60. This will overwrite the adjacent control register
WLED3_SINK_REG_STR_MOD_EN(0) (which is also defined as 0x60 + 0x00), causing
hardware control register corruption.

>  
>  #define WLED3_SINK_REG_STR_MOD_EN(n)			(0x60 + (n * 0x10))
>  #define  WLED3_SINK_REG_STR_MOD_MASK			BIT(7)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-qcom-wled-backlight-v2-0-a908d9233e93@ixit.cz?part=1

  reply	other threads:[~2026-09-14 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 17:42 [PATCH v2 0/3] backlight: qcom-wled: Fix OVP IRQ imbalance and start from the hardware state David Heidelberg via B4 Relay
2026-09-14 17:42 ` David Heidelberg
2026-09-14 17:42 ` [PATCH v2 1/3] backlight: qcom-wled: Fix WLED3 brightness register stride David Heidelberg via B4 Relay
2026-09-14 17:42   ` David Heidelberg
2026-09-14 17:50   ` sashiko-bot [this message]
2026-09-14 17:42 ` [PATCH v2 2/3] backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probe David Heidelberg via B4 Relay
2026-09-14 17:42   ` David Heidelberg
2026-09-14 17:58   ` sashiko-bot
2026-09-14 17:42 ` [PATCH v2 3/3] backlight: qcom-wled: Read back the programmed brightness " David Heidelberg via B4 Relay
2026-09-14 17:42   ` David Heidelberg
2026-09-14 17:56   ` 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=20260914175041.25D701F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=david@ixit.cz \
    --cc=dri-devel@lists.freedesktop.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.