pwm: Improve args checking in pwm_apply_state()
[linux-2.6-block.git] / include / linux / pwm.h
index 17018f3c066ed5a44c76ca77ce63b6203725ef34..908b67c847cd656489f0a679422852e7c845d18f 100644 (file)
@@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
        if (!pwm)
                return -EINVAL;
 
+       if (duty_ns < 0 || period_ns < 0)
+               return -EINVAL;
+
        pwm_get_state(pwm, &state);
        if (state.duty_cycle == duty_ns && state.period == period_ns)
                return 0;