Skip to contentSkip to conversation

pwm: remove set but not set variable 'pwm'

PATCH In review yu kuai 2 participants 2 messages Jan 20, 2020 PWM

lore
Share & tools
lore

yu kuai

author
#0 lore raw

PATCH v2 1/1 pwm: remove set but not set variable 'pwm'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/pwm/pwm-pca9685.c: In function ‘pca9685_pwm_gpio_free’:
drivers/pwm/pwm-pca9685.c:162:21: warning: variable ‘pwm’ set but not used [-Wunused-but-set-variable]

It is never used, and so can be removed. In that case, hold and release the lock 'pac->lock' can be removed since nothing will be done between them.

Fixes e926b12c611c ("pwm: Clear chip_data in pwm_put()")

---
Changes in V2:
Add Fixes and some commit message about dropping the lock 'pca->loc'.

 drivers/pwm/pwm-pca9685.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/pwm/pwm-pca9685.c +0 -4
index 168684b02ebc..b07bdca3d510 100644
@@ -159,13 +159,9 @@ static void pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,
 static void pca9685_pwm_gpio_free(struct gpio_chip *gpio, unsigned int offset)
 {
 	struct pca9685 *pca = gpiochip_get_data(gpio);
-	struct pwm_device *pwm;
 
 	pca9685_pwm_gpio_set(gpio, offset, 0);
 	pm_runtime_put(pca->chip.dev);
-	mutex_lock(&pca->lock);
-	pwm = &pca->chip.pwms[offset];
-	mutex_unlock(&pca->lock);
 }
 
 static int pca9685_pwm_gpio_get_direction(struct gpio_chip *chip,
Signature · 1 line
2.17.2
Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · yu kuai

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/pwm/pwm-pca9685.c: In function ‘pca9685_pwm_gpio_free’:
drivers/pwm/pwm-pca9685.c:162:21: warning: variable ‘pwm’ set but not used [-Wunused-but-set-variable]

Quoted 6 lines

It is never used, and so can be removed. In that case, hold and release the lock 'pac->lock' can be removed since nothing will be done between them.

Fixes e926b12c611c ("pwm: Clear chip_data in pwm_put()")

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |