# \[PATCH\] pwm: atmel: remove redundant initialization of variable timeout

- Subsystems: MICROCHIP PWM DRIVER, PWM SUBSYSTEM, THE REST
- Maintainers: Claudiu Beznea, Uwe Kleine-König, Linus Torvalds
- List: linux-arm-kernel
- 4 messages, 3 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2021/12/1603286/t

## \[PATCH\] pwm: atmel: remove redundant initialization of variable timeout

- From: Colin Ian King \<hidden\>
- Date: 2021-12-10 00:22:55 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/12/1603286.md

```text
The variable timeout is being initialized with a value that is never
read, it is being re-assigned the same value later on. Remove the
redundant initialization and keep the latter assignment because it's
closer to the use of the variable.

Signed-off-by: Colin Ian King <redacted>
---
 drivers/pwm/pwm-atmel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index 98b34ea9f38e..8e00a4286145 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -271,7 +271,7 @@ static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm,
 			      bool disable_clk)
 {
 	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
-	unsigned long timeout = jiffies + 2 * HZ;
+	unsigned long timeout;
 
 	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH\] pwm: atmel: remove redundant initialization of variable timeout

- From: Uwe Kleine-König \<hidden\>
- Date: 2021-12-10 07:46:12 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/12/1603482.md

```text
On Fri, Dec 10, 2021 at 12:22:50AM +0000, Colin Ian King wrote:
> The variable timeout is being initialized with a value that is never
> read, it is being re-assigned the same value later on. Remove the
> redundant initialization and keep the latter assignment because it's
> closer to the use of the variable.
> 
> Signed-off-by: Colin Ian King <redacted>
> ---
>  drivers/pwm/pwm-atmel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index 98b34ea9f38e..8e00a4286145 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -271,7 +271,7 @@ static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm,
>  			      bool disable_clk)
>  {
>  	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
> -	unsigned long timeout = jiffies + 2 * HZ;
> +	unsigned long timeout;
>  
>  	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);

Reviewed-by: Uwe Kleine-König <redacted>

Did you spot this by using some static checker? If so, maybe attribute
it in the commit log?

Thanks
Uwe

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

## Re: \[PATCH\] pwm: atmel: remove redundant initialization of variable timeout

- From: Colin King (gmail) \<hidden\>
- Date: 2021-12-10 09:02:20 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/12/1603558.md

```text
On 10/12/2021 07:45, Uwe Kleine-König wrote:
> On Fri, Dec 10, 2021 at 12:22:50AM +0000, Colin Ian King wrote:
>> The variable timeout is being initialized with a value that is never
>> read, it is being re-assigned the same value later on. Remove the
>> redundant initialization and keep the latter assignment because it's
>> closer to the use of the variable.
>>
>> Signed-off-by: Colin Ian King <redacted>
>> ---
>>   drivers/pwm/pwm-atmel.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
>> index 98b34ea9f38e..8e00a4286145 100644
>> --- a/drivers/pwm/pwm-atmel.c
>> +++ b/drivers/pwm/pwm-atmel.c
>> @@ -271,7 +271,7 @@ static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm,
>>   			      bool disable_clk)
>>   {
>>   	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
>> -	unsigned long timeout = jiffies + 2 * HZ;
>> +	unsigned long timeout;
>>   
>>   	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);
>
> Reviewed-by: Uwe Kleine-König <redacted>
>
> Did you spot this by using some static checker? If so, maybe attribute
> it in the commit log?

Just clang.

>
> Thanks
> Uwe
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH\] pwm: atmel: remove redundant initialization of variable timeout

- From: Thierry Reding \<hidden\>
- Date: 2022-02-24 12:54:49 
- Message: https://ratatoskr.run/linux-arm-kernel/2022/02/1683172.md

```text
On Fri, Dec 10, 2021 at 12:22:50AM +0000, Colin Ian King wrote:
> The variable timeout is being initialized with a value that is never
> read, it is being re-assigned the same value later on. Remove the
> redundant initialization and keep the latter assignment because it's
> closer to the use of the variable.
> 
> Signed-off-by: Colin Ian King <redacted>
> ---
>  drivers/pwm/pwm-atmel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry
```
