Merging conditional and WARN_ON(). WARN_ON does both these in one statement. Signed-off-by: Srikant Ritolia <s.ritolia@xxxxxxxxxxx> --- drivers/tty/serial/serial_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f2303f3..8d1d20f 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -554,10 +554,8 @@ static int uart_write(struct tty_struct *tty, * This means you called this function _after_ the port was * closed. No cookie for you. */ - if (!state) { - WARN_ON(1); + if (WARN_ON(!state)) return -EL3HLT; - } circ = &state->xmit; if (!circ->buf) @@ -618,10 +616,8 @@ static void uart_flush_buffer(struct tty_struct *tty) * This means you called this function _after_ the port was * closed. No cookie for you. */ - if (!state) { - WARN_ON(1); + if (WARN_ON(!state)) return; - } pr_debug("uart_flush_buffer(%d) called\n", tty->index); -- 2.10.2.windows.1