Re: [PATCH] pwm: remove set but not set variable 'pwm'

From: Uwe Kleine-König
Date: Mon Jan 20 2020 - 02:34:18 EST


Hello,

$Subject ~= s/not set/not used/

On Sun, Jan 19, 2020 at 08:22:02PM +0800, yu kuai wrote:
> 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.
>
> Signed-off-by: yu kuai <yukuai3@xxxxxxxxxx>

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

> ---
> drivers/pwm/pwm-pca9685.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
> index 168684b02ebc..b07bdca3d510 100644
> --- a/drivers/pwm/pwm-pca9685.c
> +++ b/drivers/pwm/pwm-pca9685.c
> @@ -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);

Did you check that dropping the locking is save? (I didn't)

I'd assume that no harm is introduced, but mentioning that in the commit
log would be good.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-KÃnig |
Industrial Linux Solutions | https://www.pengutronix.de/ |