diff options
Diffstat (limited to 'drivers/pwm/pwm-lpc32xx.c')
-rw-r--r-- | drivers/pwm/pwm-lpc32xx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c index 294a68f82558..4d470c1a406a 100644 --- a/drivers/pwm/pwm-lpc32xx.c +++ b/drivers/pwm/pwm-lpc32xx.c | |||
@@ -41,9 +41,9 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
41 | /* The highest acceptable divisor is 256, which is represented by 0 */ | 41 | /* The highest acceptable divisor is 256, which is represented by 0 */ |
42 | period_cycles = div64_u64(c * period_ns, | 42 | period_cycles = div64_u64(c * period_ns, |
43 | (unsigned long long)NSEC_PER_SEC * 256); | 43 | (unsigned long long)NSEC_PER_SEC * 256); |
44 | if (!period_cycles) | 44 | if (!period_cycles || period_cycles > 256) |
45 | period_cycles = 1; | 45 | return -ERANGE; |
46 | if (period_cycles > 255) | 46 | if (period_cycles == 256) |
47 | period_cycles = 0; | 47 | period_cycles = 0; |
48 | 48 | ||
49 | /* Compute 256 x #duty/period value and care for corner cases */ | 49 | /* Compute 256 x #duty/period value and care for corner cases */ |