diff mbox series

mxser: remove redundant assignment to hwid

Message ID 20220730130925.150018-1-colin.i.king@gmail.com (mailing list archive)
State New, archived
Headers show
Series mxser: remove redundant assignment to hwid | expand

Commit Message

Colin Ian King July 30, 2022, 1:09 p.m. UTC
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]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/tty/mxser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Slaby Aug. 4, 2022, 5:43 a.m. UTC | #1
On 30. 07. 22, 15:09, Colin Ian King wrote:
> 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]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Acked-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/mxser.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
> index 70b982b2c6b2..600c71e5eebc 100644
> --- a/drivers/tty/mxser.c
> +++ b/drivers/tty/mxser.c
> @@ -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.

>   		outb(oldmcr, io + UART_MCR);
>   		return MOXA_OTHER_UART;
>   	}

thanks,
diff mbox series

Patch

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 70b982b2c6b2..600c71e5eebc 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -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;
 	}