From: Uwe Kleine-König Date: Fri, 12 Mar 2021 08:59:16 +0000 (+0100) Subject: pwm: sprd: Refuse requests with unsupported polarity X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=09081c9ba6c22bd63b6ce681e60d71a95acbc115;p=linux.git pwm: sprd: 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: Chunyan Zhang Signed-off-by: Thierry Reding --- diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c index 108cbec88667b..98c479dfae318 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) { /*