From 09081c9ba6c22bd63b6ce681e60d71a95acbc115 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 12 Mar 2021 09:59:16 +0100 Subject: pwm: sprd: Refuse requests with unsupported polarity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The driver only supports normal polarity and so should refuse requests for inversed polarity. Signed-off-by: Uwe Kleine-König Acked-by: Chunyan Zhang Signed-off-by: Thierry Reding --- drivers/pwm/pwm-sprd.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/pwm') diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c index 108cbec88667..98c479dfae31 100644 --- a/drivers/pwm/pwm-sprd.c +++ b/drivers/pwm/pwm-sprd.c @@ -164,6 +164,9 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *cstate = &pwm->state; int ret; + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + if (state->enabled) { if (!cstate->enabled) { /* -- cgit