Commit 12f3a5eb authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

tty: serial: do unlock on a common path in altera_jtaguart_console_putc()



port->lock is unlocked in each branch in altera_jtaguart_console_putc(),
so do it before the "if". "status" needs not be under the lock, as the
register was already read.

Cc: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: default avatarTobias Klauser <tklauser@distanz.ch>
Link: https://lore.kernel.org/r/20220927111819.18516-4-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 523f54ed
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -310,11 +310,12 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c

	spin_lock_irqsave(&port->lock, flags);
	while (!altera_jtaguart_tx_space(port, &status)) {
		if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) {
		spin_unlock_irqrestore(&port->lock, flags);

		if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) {
			return;	/* no connection activity */
		}
		spin_unlock_irqrestore(&port->lock, flags);

		cpu_relax();
		spin_lock_irqsave(&port->lock, flags);
	}