pwm: crc: Propagate errors in .get_state() to the caller
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 2 Dec 2022 18:35:30 +0000 (19:35 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 6 Dec 2022 11:46:25 +0000 (12:46 +0100)
.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221130152148.2769768-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-crc.c

index 4099850117ba4bba4da8e0c975409f17427c1acd..4703b4a0b6e4ad8a7f355e03e8c7e784d6b6ca64 100644 (file)
@@ -132,13 +132,13 @@ static int crc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
        error = regmap_read(crc_pwm->regmap, PWM0_CLK_DIV, &clk_div_reg);
        if (error) {
                dev_err(dev, "Error reading PWM0_CLK_DIV %d\n", error);
-               return 0;
+               return error;
        }
 
        error = regmap_read(crc_pwm->regmap, PWM0_DUTY_CYCLE, &duty_cycle_reg);
        if (error) {
                dev_err(dev, "Error reading PWM0_DUTY_CYCLE %d\n", error);
-               return 0;
+               return error;
        }
 
        clk_div = (clk_div_reg & ~PWM_OUTPUT_ENABLE) + 1;