Skip to content

Commit 9bda6a8

Browse files
author
Uwe Kleine-König
committed
staging: greybus: pwm: Rely on pwm framework to pass a valid hwpwm
The pwm framework already asserts to only pass a hwpwm value (= which) less than npwm (= pwmc->pwm_max + 1). So there is no need to recheck this condition. Drop the respective checks. Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/e003bc5e8e66f27f2b8fdc525a536d865888cffe.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 4aacf5f commit 9bda6a8

File tree

1 file changed

+0
-18
lines changed
  • drivers/staging/greybus

1 file changed

+0
-18
lines changed

drivers/staging/greybus/pwm.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ static int gb_pwm_activate_operation(struct pwm_chip *chip, u8 which)
4646
struct gbphy_device *gbphy_dev;
4747
int ret;
4848

49-
if (which > pwmc->pwm_max)
50-
return -EINVAL;
51-
5249
request.which = which;
5350

5451
gbphy_dev = to_gbphy_dev(pwmchip_parent(chip));
@@ -71,9 +68,6 @@ static int gb_pwm_deactivate_operation(struct pwm_chip *chip, u8 which)
7168
struct gbphy_device *gbphy_dev;
7269
int ret;
7370

74-
if (which > pwmc->pwm_max)
75-
return -EINVAL;
76-
7771
request.which = which;
7872

7973
gbphy_dev = to_gbphy_dev(pwmchip_parent(chip));
@@ -97,9 +91,6 @@ static int gb_pwm_config_operation(struct pwm_chip *chip,
9791
struct gbphy_device *gbphy_dev;
9892
int ret;
9993

100-
if (which > pwmc->pwm_max)
101-
return -EINVAL;
102-
10394
request.which = which;
10495
request.duty = cpu_to_le32(duty);
10596
request.period = cpu_to_le32(period);
@@ -125,9 +116,6 @@ static int gb_pwm_set_polarity_operation(struct pwm_chip *chip,
125116
struct gbphy_device *gbphy_dev;
126117
int ret;
127118

128-
if (which > pwmc->pwm_max)
129-
return -EINVAL;
130-
131119
request.which = which;
132120
request.polarity = polarity;
133121

@@ -151,9 +139,6 @@ static int gb_pwm_enable_operation(struct pwm_chip *chip, u8 which)
151139
struct gbphy_device *gbphy_dev;
152140
int ret;
153141

154-
if (which > pwmc->pwm_max)
155-
return -EINVAL;
156-
157142
request.which = which;
158143

159144
gbphy_dev = to_gbphy_dev(pwmchip_parent(chip));
@@ -176,9 +161,6 @@ static int gb_pwm_disable_operation(struct pwm_chip *chip, u8 which)
176161
struct gbphy_device *gbphy_dev;
177162
int ret;
178163

179-
if (which > pwmc->pwm_max)
180-
return -EINVAL;
181-
182164
request.which = which;
183165

184166
ret = gb_operation_sync(pwmc->connection, GB_PWM_TYPE_DISABLE,

0 commit comments

Comments
 (0)