Found a bug in samsung serial tty code

Woody Wu narkewoody at gmail.com
Sun Apr 17 00:52:44 PDT 2016


Hi,

The function s3c24xx_serial_tx_empty() in tty/serial/samsung.c is wrong:

static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)
{
struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);
unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT);
unsigned long ufcon = rd_regl(port, S3C2410_UFCON);

if (ufcon & S3C2410_UFCON_FIFOMODE) {
if ((ufstat & info->tx_fifomask) != 0 ||
   (ufstat & info->tx_fifofull))
return 0;

return 1;
}

return s3c24xx_serial_txempty_nofifo(port);
}

In FIFO mode, checking only ufcon is not enough to determine that the
tx is really done, since there is still bits in shift register.  I
found this is true at least in S3C2416 UARTs.  I have to remove the
'return 1' above to fix the bug.   Can anyone give me a confirmation?
Thanks!


-- 
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

woody
public key at http://subkeys.pgp.net:11371 (narkewoody at gmail.com)



More information about the linux-arm-kernel mailing list