diff options
| author | Haotian Zhang <vulab@iscas.ac.cn> | 2026-01-09 01:51:33 +0800 |
|---|---|---|
| committer | Sasha Levin <sashal@kernel.org> | 2026-03-04 07:20:33 -0500 |
| commit | 37fa7dd1378670ba2ca2a1df68861050c57430e0 (patch) | |
| tree | 6b9c1d285c2420027bfac7375ad60c9b669e679d /drivers/leds | |
| parent | 7814b1431848854b56717086e2b61bea3c59753d (diff) | |
| download | linux-37fa7dd1378670ba2ca2a1df68861050c57430e0.tar.gz linux-37fa7dd1378670ba2ca2a1df68861050c57430e0.tar.bz2 linux-37fa7dd1378670ba2ca2a1df68861050c57430e0.zip | |
leds: qcom-lpg: Check the return value of regmap_bulk_write()
[ Upstream commit f42033b5ce8c79c5db645916c9a72ee3e10cecfa ]
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>
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>
Diffstat (limited to 'drivers/leds')
| -rw-r--r-- | drivers/leds/rgb/leds-qcom-lpg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c index 84e02867f3b4..98c60e971b48 100644 --- a/drivers/leds/rgb/leds-qcom-lpg.c +++ b/drivers/leds/rgb/leds-qcom-lpg.c @@ -368,7 +368,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); @@ -378,8 +378,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), - &val, sizeof(val)); + ret = regmap_bulk_write(lpg->map, lpg->lut_base + LPG_LUT_REG(idx + i), + &val, sizeof(val)); + if (ret) + return ret; } bitmap_set(lpg->lut_bitmap, idx, len); |
