Skip to contentSkip to conversation

USB: serial: usb_wwan: remove redundant assignment to variable i

PATCH Applied Colin Ian King 2 participants 2 messages Mar 7, 2022 – Mar 8, 2022

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

PATCH 1/1 USB: serial: usb_wwan: remove redundant assignment to variable i

Variable i is being assigned a value that is never read, it is being re-assigned two statements later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/usb/serial/usb_wwan.c:151:2: warning: Value stored to 'i' is never read [deadcode.DeadStores]

---
 drivers/usb/serial/usb_wwan.c | 1 -
 1 file changed, 1 deletion(-)
drivers/usb/serial/usb_wwan.c +0 -1
index cb01283d4d15..dab38b63eaf7 100644
@@ -148,7 +148,6 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
 
 	dev_dbg(&port->dev, "%s: write (%d chars)\n", __func__, count);
 
-	i = 0;
 	left = count;
 	for (i = 0; left > 0 && i < N_OUT_URB; i++) {
 		todo = left;
Signature · 1 line
2.35.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Colin Ian King

Variable i is being assigned a value that is never read, it is being re-assigned two statements later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/usb/serial/usb_wwan.c:151:2: warning: Value stored to 'i' is never read [deadcode.DeadStores]

Applied, thanks.

Johan