From: Lee Jones <lee@kernel.org>
To: Haotian Zhang <vulab@iscas.ac.cn>
Cc: pavel@kernel.org, abel.vesa@linaro.org,
marijn.suijten@somainline.org, sre@kernel.org,
andersson@kernel.org, anjelique.melendez@oss.qualcomm.com,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: qcom-lpg: Check the return value of regmap_bulk_write()
Date: Thu, 8 Jan 2026 11:06:22 +0000 [thread overview]
Message-ID: <20260108110622.GD302752@google.com> (raw)
In-Reply-To: <20251204061728.124-1-vulab@iscas.ac.cn>
On Thu, 04 Dec 2025, Haotian Zhang wrote:
> The lpg_lut_store() function currently ignores the return value of
> regmap_bulk_write() and always returns 0. This can cause hardware write
> failures to go undetected, leading the caller to believe LUT programming
> succeeded when it may have failed.
>
> Check the return value of regmap_bulk_write() in lpg_lut_store and return
> the error to the caller on failure.
>
> Fixes: 24e2d05d1b68 ("leds: Add driver for Qualcomm LPG")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
> drivers/leds/rgb/leds-qcom-lpg.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 4f2a178e3d26..76734b1520f6 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -369,7 +369,7 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
> {
> unsigned int idx;
> u16 val;
> - int i;
> + int i, ret;
>
> idx = bitmap_find_next_zero_area(lpg->lut_bitmap, lpg->lut_size,
> 0, len, 0);
> @@ -379,8 +379,10 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
> for (i = 0; i < len; i++) {
> val = pattern[i].brightness;
>
> - regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
> + ret = regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
> &val, sizeof(val));
Fine, but you need to re-align this to the '(' above.
> + if (ret)
> + return ret;
> }
>
> bitmap_set(lpg->lut_bitmap, idx, len);
> --
> 2.50.1.windows.1
>
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2026-01-08 11:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 6:17 [PATCH] leds: qcom-lpg: Check the return value of regmap_bulk_write() Haotian Zhang
2026-01-08 11:06 ` Lee Jones [this message]
2026-01-08 17:51 ` [PATCH v2] " Haotian Zhang
2026-01-13 12:29 ` (subset) " Lee Jones
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=20260108110622.GD302752@google.com \
--to=lee@kernel.org \
--cc=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=anjelique.melendez@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=pavel@kernel.org \
--cc=sre@kernel.org \
--cc=vulab@iscas.ac.cn \
/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