Re: [PATCH] pwm: meson: remove redundant assignment to variable fin_freq

From: Uwe Kleine-König
Date: Thu Apr 02 2020 - 10:15:23 EST


On Thu, Apr 02, 2020 at 12:08:57PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> The variable fin_freq is being initialized with a value that is never
> read and it is being updated later with a new value. The initialization
> is redundant and can be removed.
>
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

This was introduced in 211ed630753d ("pwm: Add support for Meson PWM
Controller"), adding Neil To Cc:.

I don't think this was added to cope for a compiler not being able to
see the variable is used initialized only.

Acked-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>

Thanks
Uwe

> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 8cf9129caa39..bd0d7336b898 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -163,7 +163,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
> {
> struct meson_pwm_channel *channel = pwm_get_chip_data(pwm);
> unsigned int duty, period, pre_div, cnt, duty_cnt;
> - unsigned long fin_freq = -1;
> + unsigned long fin_freq;
>
> duty = state->duty_cycle;
> period = state->period;

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