Skip to contentSkip to conversation

pwm: atmel: remove redundant initialization of variable timeout

PATCH Applied Colin Ian King 3 participants 4 messages Dec 10, 2021 – Feb 24, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: atmel: remove redundant initialization of variable timeout

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.

---
 drivers/pwm/pwm-atmel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-atmel.c +1 -1
index 98b34ea9f38e..8e00a4286145 100644
@@ -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);
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Colin Ian King

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.

---
 drivers/pwm/pwm-atmel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-atmel.c +0 -0
index 98b34ea9f38e..8e00a4286145 100644

drivers/pwm/pwm-atmel.c static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm, · line 276

Quoted 7 lines
drivers/pwm/pwm-atmel.c +1 -1
@@ -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);

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

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw
Quoted 22 lines · Uwe Kleine-König
Quoted 21 lines · Colin Ian King

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.

---
  drivers/pwm/pwm-atmel.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-atmel.c +1 -1
index 98b34ea9f38e..8e00a4286145 100644
@@ -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;
 
Quoted 6 lines

drivers/pwm/pwm-atmel.c static void atmel_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm, · line 276

Quoted 1 line
drivers/pwm/pwm-atmel.c +0 -0
  	atmel_pwm_wait_nonpending(atmel_pwm, pwm->hwpwm);

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

Just clang.

Quoted 4 lines

Thanks
Uwe

#3 lore raw
In reply to Colin Ian King
Quoted 9 lines · Colin Ian King

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.

---
 drivers/pwm/pwm-atmel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry