pwm: cros-ec: Propagate errors in .get_state() to the caller

.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221130152148.2769768-7-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>
This commit is contained in:
Uwe Kleine-König 2022-12-02 19:35:31 +01:00 committed by Thierry Reding
parent 9c9d5e9957
commit ee02c1cb87
1 changed files with 1 additions and 1 deletions

View File

@ -193,7 +193,7 @@ static int cros_ec_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
ret = cros_ec_pwm_get_duty(ec_pwm, pwm->hwpwm);
if (ret < 0) {
dev_err(chip->dev, "error getting initial duty: %d\n", ret);
return 0;
return ret;
}
state->enabled = (ret > 0);