]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
serial: 8250: invert condition to avoid a goto label
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 11 Jun 2025 10:03:17 +0000 (12:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jun 2025 11:42:36 +0000 (13:42 +0200)
Use of "goto" in this code is frowned upon:
 +-------
 |if (port->type == PORT_UNKNOWN)
 |  goto out_unlock;
 |CODE;
 |out_unlock:
 +-------

Instead, simply do:
 +-------
 |if (port->type != PORT_UNKNOWN)
 |  CODE;
 +-------

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611100319.186924-32-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c

index e93bfdac3d0ea095317d04468b751d2b800f3112..48c30e158cb8d5287336222b51b171c7d0225050 100644 (file)
@@ -1184,19 +1184,17 @@ static void autoconfig(struct uart_8250_port *up)
        up->capabilities = uart_config[port->type].flags;
        up->tx_loadsz = uart_config[port->type].tx_loadsz;
 
-       if (port->type == PORT_UNKNOWN)
-               goto out_unlock;
-
-       /*
-        * Reset the UART.
-        */
-       rsa_reset(up);
-       serial8250_out_MCR(up, save_mcr);
-       serial8250_clear_fifos(up);
-       serial_in(up, UART_RX);
-       serial8250_clear_IER(up);
+       if (port->type != PORT_UNKNOWN) {
+               /*
+                * Reset the UART.
+                */
+               rsa_reset(up);
+               serial8250_out_MCR(up, save_mcr);
+               serial8250_clear_fifos(up);
+               serial_in(up, UART_RX);
+               serial8250_clear_IER(up);
+       }
 
-out_unlock:
        uart_port_unlock_irqrestore(port, flags);
 
        /*