aboutsummaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-bfin.c
diff options
context:
space:
mode:
authorThierry Reding <[email protected]>2012-09-02 22:13:40 +0200
committerThierry Reding <[email protected]>2012-10-05 20:56:43 +0200
commitc2d476a98f71c55e9acdca1d5a1080a22c0622af (patch)
tree550ef5612d413d39f6d5928ea261eab9fd859fac /drivers/pwm/pwm-bfin.c
parentf6b8a5700057cc1b531c2f9b7806428a6f83b467 (diff)
pwm: Check for negative duty-cycle and period
Make sure the duty-cycle and period passed in are not negative. This should eventually be made implicit by making them unsigned. While at it, the drivers' .config() implementations can have the equivalent checks removed. Signed-off-by: Thierry Reding <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Mark Brown <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Sachin Kamat <[email protected]> Cc: Axel Lin <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Jingoo Han <[email protected]> Cc: Jonghwan Choi <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: "Philip, Avinash" <[email protected]> Cc: Vaibhav Bedia <[email protected]> Acked-by: Jingoo Han <[email protected]>
Diffstat (limited to 'drivers/pwm/pwm-bfin.c')
-rw-r--r--drivers/pwm/pwm-bfin.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/pwm/pwm-bfin.c b/drivers/pwm/pwm-bfin.c
index d53c4e7941ef..5da8e185e838 100644
--- a/drivers/pwm/pwm-bfin.c
+++ b/drivers/pwm/pwm-bfin.c
@@ -69,9 +69,6 @@ static int bfin_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
unsigned long period, duty;
unsigned long long val;
- if (duty_ns < 0 || duty_ns > period_ns)
- return -EINVAL;
-
val = (unsigned long long)get_sclk() * period_ns;
do_div(val, NSEC_PER_SEC);
period = val;