From: Uwe Kleine-König Date: Fri, 12 Mar 2021 09:00:58 +0000 (+0100) Subject: pwm: cros-ec: Refuse requests with unsupported polarity X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9f0f6107e07289c99f599d4e4ad9c62dec4abfd6;p=linux.git pwm: cros-ec: Refuse requests with unsupported polarity The driver only supports normal polarity and so should refuse requests for inversed polarity. Signed-off-by: Uwe Kleine-König Acked-by: Enric Balletbo i Serra Signed-off-by: Thierry Reding --- diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c index d3115cb0e058e..9fffb566af5f9 100644 --- a/drivers/pwm/pwm-cros-ec.c +++ b/drivers/pwm/pwm-cros-ec.c @@ -124,6 +124,9 @@ static int cros_ec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (state->period != EC_PWM_MAX_DUTY) return -EINVAL; + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + /* * EC doesn't separate the concept of duty cycle and enabled, but * kernel does. Translate.