Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: "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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
6529c88f 05b537a1

+10 -12
+10 -12
drivers/tty/serial/8250/8250_port.c
··· 1184 1184 up->capabilities = uart_config[port->type].flags; 1185 1185 up->tx_loadsz = uart_config[port->type].tx_loadsz; 1186 1186 1187 - if (port->type == PORT_UNKNOWN) 1188 - goto out_unlock; 1187 + if (port->type != PORT_UNKNOWN) { 1188 + /* 1189 + * Reset the UART. 1190 + */ 1191 + rsa_reset(up); 1192 + serial8250_out_MCR(up, save_mcr); 1193 + serial8250_clear_fifos(up); 1194 + serial_in(up, UART_RX); 1195 + serial8250_clear_IER(up); 1196 + } 1189 1197 1190 - /* 1191 - * Reset the UART. 1192 - */ 1193 - rsa_reset(up); 1194 - serial8250_out_MCR(up, save_mcr); 1195 - serial8250_clear_fifos(up); 1196 - serial_in(up, UART_RX); 1197 - serial8250_clear_IER(up); 1198 - 1199 - out_unlock: 1200 1198 uart_port_unlock_irqrestore(port, flags); 1201 1199 1202 1200 /*