Skip to content

Commit fea768c

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
leds: qcom-lpg: Propagate errors in .get_state() to the caller
.get_state() can return an error indication. Make use of it to propagate failing hardware accesses. Acked-by: Pavel Machek <[email protected]> Acked-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent f00de18 commit fea768c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -982,20 +982,20 @@ static int lpg_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
982982

983983
ret = regmap_read(lpg->map, chan->base + LPG_SIZE_CLK_REG, &val);
984984
if (ret)
985-
return 0;
985+
return ret;
986986

987987
refclk = lpg_clk_rates[val & PWM_CLK_SELECT_MASK];
988988
if (refclk) {
989989
ret = regmap_read(lpg->map, chan->base + LPG_PREDIV_CLK_REG, &val);
990990
if (ret)
991-
return 0;
991+
return ret;
992992

993993
pre_div = lpg_pre_divs[FIELD_GET(PWM_FREQ_PRE_DIV_MASK, val)];
994994
m = FIELD_GET(PWM_FREQ_EXP_MASK, val);
995995

996996
ret = regmap_bulk_read(lpg->map, chan->base + PWM_VALUE_REG, &pwm_value, sizeof(pwm_value));
997997
if (ret)
998-
return 0;
998+
return ret;
999999

10001000
state->period = DIV_ROUND_UP_ULL((u64)NSEC_PER_SEC * LPG_RESOLUTION * pre_div * (1 << m), refclk);
10011001
state->duty_cycle = DIV_ROUND_UP_ULL((u64)NSEC_PER_SEC * pwm_value * pre_div * (1 << m), refclk);
@@ -1006,7 +1006,7 @@ static int lpg_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
10061006

10071007
ret = regmap_read(lpg->map, chan->base + PWM_ENABLE_CONTROL_REG, &val);
10081008
if (ret)
1009-
return 0;
1009+
return ret;
10101010

10111011
state->enabled = FIELD_GET(LPG_ENABLE_CONTROL_OUTPUT, val);
10121012
state->polarity = PWM_POLARITY_NORMAL;

0 commit comments

Comments
 (0)