pwm: rockchip: Set polarity unconditionally in .get_state()
authorUwe Kleine-König <uwe@kleine-koenig.org>
Mon, 2 Sep 2019 14:39:41 +0000 (16:39 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 20 Sep 2019 23:48:54 +0000 (01:48 +0200)
Don't rely on *state being zero initialized and PWM_POLARITY_NORMAL
being zero. So always assign .polarity.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-rockchip.c

index 51b96cb..8eb2db5 100644 (file)
@@ -90,10 +90,10 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip,
                state->enabled = ((val & enable_conf) == enable_conf) ?
                                 true : false;
 
-       if (pc->data->supports_polarity) {
-               if (!(val & PWM_DUTY_POSITIVE))
-                       state->polarity = PWM_POLARITY_INVERSED;
-       }
+       if (pc->data->supports_polarity && !(val & PWM_DUTY_POSITIVE))
+               state->polarity = PWM_POLARITY_INVERSED;
+       else
+               state->polarity = PWM_POLARITY_NORMAL;
 
        clk_disable(pc->pclk);
 }