diff mbox series

[v2,10/11] pwm: sprd: Propagate errors in .get_state() to the caller

Message ID 20221130152148.2769768-11-u.kleine-koenig@pengutronix.de
State Accepted
Headers show
Series pwm: Allow .get_state to fail | expand

Commit Message

Uwe Kleine-König Nov. 30, 2022, 3:21 p.m. UTC
.get_state() can return an error indication. Make use of it to propagate
failing hardware accesses.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-sprd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Baolin Wang Dec. 1, 2022, 1:18 a.m. UTC | #1
On 11/30/2022 11:21 PM, Uwe Kleine-König wrote:
> .get_state() can return an error indication. Make use of it to propagate
> failing hardware accesses.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/pwm/pwm-sprd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
> index bda8bc5af976..d866ce345f97 100644
> --- a/drivers/pwm/pwm-sprd.c
> +++ b/drivers/pwm/pwm-sprd.c
> @@ -83,7 +83,7 @@ static int sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>   	if (ret) {
>   		dev_err(spc->dev, "failed to enable pwm%u clocks\n",
>   			pwm->hwpwm);
> -		return 0;
> +		return ret;
>   	}
>   
>   	val = sprd_pwm_read(spc, pwm->hwpwm, SPRD_PWM_ENABLE);
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
index bda8bc5af976..d866ce345f97 100644
--- a/drivers/pwm/pwm-sprd.c
+++ b/drivers/pwm/pwm-sprd.c
@@ -83,7 +83,7 @@  static int sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
 	if (ret) {
 		dev_err(spc->dev, "failed to enable pwm%u clocks\n",
 			pwm->hwpwm);
-		return 0;
+		return ret;
 	}
 
 	val = sprd_pwm_read(spc, pwm->hwpwm, SPRD_PWM_ENABLE);