lkml.org 
[lkml]   [2022]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] pwm: removes period check from pwm_apply_state()
Date
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
\
 
 \ /
  Last update: 2022-08-05 17:41    [W:0.192 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site