Skip to content

Commit 9ee124c

Browse files
ukleinekUwe Kleine-König
authored andcommitted
pwm: Fix invalid state detection
Commit 9dd42d0 ("pwm: Allow pwm state transitions from an invalid state") intended to allow some state transitions that were not allowed before. The idea is sane and back then I also got the code comment right, but the check for enabled is bogus. This resulted in state transitions for enabled states to be allowed to have invalid duty/period settings and thus it can happen that low-level drivers get requests for invalid states🙄. Invert the check to allow state transitions for disabled states only. Fixes: 9dd42d0 ("pwm: Allow pwm state transitions from an invalid state") Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 19272b3 commit 9ee124c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pwm/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ static bool pwm_state_valid(const struct pwm_state *state)
596596
* and supposed to be ignored. So also ignore any strange values and
597597
* consider the state ok.
598598
*/
599-
if (state->enabled)
599+
if (!state->enabled)
600600
return true;
601601

602602
if (!state->period)

0 commit comments

Comments
 (0)