Skip to contentSkip to conversation

mxser: remove redundant assignment to hwid

PATCH In review Colin Ian King 2 participants 2 messages Jul 30, 2022 – Aug 4, 2022

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

PATCH 1/1 mxser: remove redundant assignment to hwid

The variable hwid is assigned a value but it is never read. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/tty/mxser.c:401:7: warning: Although the value stored to 'hwid' is used in the enclosing expression, the value is never actually read from 'hwid' [deadcode.DeadStores]

---
 drivers/tty/mxser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/mxser.c +1 -1
index 70b982b2c6b2..600c71e5eebc 100644
@@ -398,7 +398,7 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io)
 	oldmcr = inb(io + UART_MCR);
 	outb(0, io + UART_MCR);
 	mxser_set_must_xon1_value(io, 0x11);
-	if ((hwid = inb(io + UART_MCR)) != 0) {
+	if (inb(io + UART_MCR) != 0) {
 		outb(oldmcr, io + UART_MCR);
 		return MOXA_OTHER_UART;
 	}
Signature · 1 line
2.35.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Colin Ian King

The variable hwid is assigned a value but it is never read. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/tty/mxser.c:401:7: warning: Although the value stored to 'hwid' is used in the enclosing expression, the value is never actually read from 'hwid' [deadcode.DeadStores]

Quoted 9 lines
---
  drivers/tty/mxser.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/mxser.c +0 -0
index 70b982b2c6b2..600c71e5eebc 100644

drivers/tty/mxser.c static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) · line 401

Quoted 5 lines
drivers/tty/mxser.c +1 -1
@@ -398,7 +398,7 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io)
  	oldmcr = inb(io + UART_MCR);
  	outb(0, io + UART_MCR);
  	mxser_set_must_xon1_value(io, 0x11);
-	if ((hwid = inb(io + UART_MCR)) != 0) {
+	if (inb(io + UART_MCR) != 0) {

Yes, hwid is read later, this was a dummy assignment.

drivers/tty/mxser.c static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) · line 404

Quoted 3 lines
drivers/tty/mxser.c +0 -0
  		outb(oldmcr, io + UART_MCR);
  		return MOXA_OTHER_UART;
  	}

thanks,

Signature · 2 lines
js
suse labs