Skip to content
/ linux Public

Commit 97790c9

Browse files
ISCAS-VulabSasha Levin
authored andcommitted
leds: qcom-lpg: Check the return value of regmap_bulk_write()
[ Upstream commit f42033b ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 99cc735 commit 97790c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
221221
{
222222
unsigned int idx;
223223
u16 val;
224-
int i;
224+
int i, ret;
225225

226226
idx = bitmap_find_next_zero_area(lpg->lut_bitmap, lpg->lut_size,
227227
0, len, 0);
@@ -231,8 +231,10 @@ static int lpg_lut_store(struct lpg *lpg, struct led_pattern *pattern,
231231
for (i = 0; i < len; i++) {
232232
val = pattern[i].brightness;
233233

234-
regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
235-
&val, sizeof(val));
234+
ret = regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i),
235+
&val, sizeof(val));
236+
if (ret)
237+
return ret;
236238
}
237239

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

0 commit comments

Comments
 (0)