[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260108110622.GD302752@google.com>
Date: Thu, 8 Jan 2026 11:06:22 +0000
From: Lee Jones <lee@...nel.org>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: pavel@...nel.org, abel.vesa@...aro.org, marijn.suijten@...ainline.org,
sre@...nel.org, andersson@...nel.org,
anjelique.melendez@....qualcomm.com, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: qcom-lpg: Check the return value of
regmap_bulk_write()
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@...as.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 [李琼斯]
Powered by blists - more mailing lists