diff options
| author | Uwe Kleine-König <[email protected]> | 2025-07-04 17:24:17 +0000 |
|---|---|---|
| committer | Uwe Kleine-König <[email protected]> | 2025-07-07 06:33:44 +0000 |
| commit | 9ee124caae1b0defd0e02c65686f539845a3ac9b (patch) | |
| tree | 245b31b9113579ff7e5c8e83215540f55dae253a | |
| parent | Linux 6.16-rc1 (diff) | |
| download | kernel-9ee124caae1b0defd0e02c65686f539845a3ac9b.tar.gz kernel-9ee124caae1b0defd0e02c65686f539845a3ac9b.zip | |
pwm: Fix invalid state detection
Commit 9dd42d019e63 ("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: 9dd42d019e63 ("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]>
| -rw-r--r-- | drivers/pwm/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 4d842c692194..edf776b8ad53 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -596,7 +596,7 @@ static bool pwm_state_valid(const struct pwm_state *state) * and supposed to be ignored. So also ignore any strange values and * consider the state ok. */ - if (state->enabled) + if (!state->enabled) return true; if (!state->period) |
