Instead of using: if (cond){ WARN_ON(1); do_stuff(); } Use a better pattern with WARN_ON() placed in if condition. if (WARN_ON(cond)) do_stuff(); 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); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html