[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220805101125.47955-1-m.shams@samsung.com>
Date: Fri, 5 Aug 2022 15:41:25 +0530
From: Tamseel Shams <m.shams@...sung.com>
To: thierry.reding@...il.com, u.kleine-koenig@...gutronix.de,
lee.jones@...aro.org
Cc: linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
alim.akhtar@...sung.com, Tamseel Shams <m.shams@...sung.com>
Subject: [PATCH] pwm: removes period check from pwm_apply_state()
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@...sung.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
Powered by blists - more mailing lists