projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
UPSTREAM: pwm: Improve args checking in pwm_apply_state()
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
pwm
/
core.c
diff --git
a/drivers/pwm/core.c
b/drivers/pwm/core.c
index 6ec9a0ce9c44753451ac6855f16d659731659a52..869af8448059aa1115ceca08014f2cd658617305 100644
(file)
--- a/
drivers/pwm/core.c
+++ b/
drivers/pwm/core.c
@@
-459,7
+459,8
@@
int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
{
int err;
- if (!pwm)
+ if (!pwm || !state || !state->period ||
+ state->duty_cycle > state->period)
return -EINVAL;
if (!memcmp(state, &pwm->state, sizeof(*state)))