Messages in this thread Patch in this message | | | From | Tamseel Shams <> | Subject | [PATCH] pwm: removes period check from pwm_apply_state() | Date | Fri, 5 Aug 2022 15:41:25 +0530 |
| |
There may be situation when PWM is exported using sysfs, but at that point PWM period is not set. At this situation if we issue a system suspend, it calls pwm_class_suspend which in turn calls pwm_apply_state, where PWM period value is checked which returns an invalid argument error casuing Kernel to panic. So, check for PWM period value is removed so as to fix the kernel panic observed during suspend.
Signed-off-by: Tamseel Shams <m.shams@samsung.com> --- drivers/pwm/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index c7552df32082..69bca7f82398 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -634,8 +634,7 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) */ might_sleep(); - if (!pwm || !state || !state->period || - state->duty_cycle > state->period) + if (!pwm || !state || state->duty_cycle > state->period) return -EINVAL; chip = pwm->chip; -- 2.17.1
| |