Skip to content

Commit f42033b

Browse files
ISCAS-Vulablag-linaro
authored andcommitted
leds: qcom-lpg: Check the return value of regmap_bulk_write()
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: 24e2d05 ("leds: Add driver for Qualcomm LPG") Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260108175133.638-1-vulab@iscas.ac.cn Signed-off-by: Lee Jones <lee@kernel.org>
1 parent ec924cd commit f42033b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/leds/rgb/leds-qcom-lpg.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
369369
{
370370
unsigned int idx;
371371
u16 val;
372-
int i;
372+
int i, ret;
373373

374374
idx = bitmap_find_next_zero_area(lpg->lut_bitmap, lpg->lut_size,
375375
0, len, 0);
@@ -379,8 +379,10 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
379379
for (i = 0; i < len; i++) {
380380
val = pattern[i].brightness;
381381

382-
regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
383-
&val, sizeof(val));
382+
ret = regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
383+
&val, sizeof(val));
384+
if (ret)
385+
return ret;
384386
}
385387

386388
bitmap_set(lpg->lut_bitmap, idx, len);

0 commit comments

Comments
 (0)