Commit 6529c88f authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman
Browse files

serial: 8250: invert condition to avoid a goto label



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: default avatar"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611100319.186924-32-jirislaby@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 05b537a1
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -1184,9 +1184,7 @@ 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;

	if (port->type != PORT_UNKNOWN) {
		/*
		 * Reset the UART.
		 */
@@ -1195,8 +1193,8 @@ static void autoconfig(struct uart_8250_port *up)
		serial8250_clear_fifos(up);
		serial_in(up, UART_RX);
		serial8250_clear_IER(up);
	}

out_unlock:
	uart_port_unlock_irqrestore(port, flags);

	/*