From c2d476a98f71c55e9acdca1d5a1080a22c0622af Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Sun, 2 Sep 2012 22:13:40 +0200 Subject: 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 Cc: Shawn Guo Cc: Mark Brown Cc: Arnd Bergmann Cc: Sachin Kamat Cc: Axel Lin Cc: Kukjin Kim Cc: Jingoo Han Cc: Jonghwan Choi Cc: Sascha Hauer Cc: "Philip, Avinash" Cc: Vaibhav Bedia Acked-by: Jingoo Han --- drivers/pwm/pwm-tiecap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/pwm/pwm-tiecap.c') diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index 081471fbb097..d6d4cf05565e 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c @@ -60,7 +60,7 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, unsigned long period_cycles, duty_cycles; unsigned int reg_val; - if (period_ns < 0 || duty_ns < 0 || period_ns > NSEC_PER_SEC) + if (period_ns > NSEC_PER_SEC) return -ERANGE; c = pc->clk_rate; -- cgit v1.2.3