Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752553AbbKHSDI (ORCPT ); Sun, 8 Nov 2015 13:03:08 -0500 Received: from mail-ig0-f173.google.com ([209.85.213.173]:38612 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328AbbKHSBs (ORCPT ); Sun, 8 Nov 2015 13:01:48 -0500 From: Peter Hurley To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-kernel@vger.kernel.org, Peter Hurley Subject: [PATCH 13/14] tty: Merge conditional + error message + WARN_ON() Date: Sun, 8 Nov 2015 13:01:20 -0500 Message-Id: <1447005681-4912-14-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1447005681-4912-1-git-send-email-peter@hurleysoftware.com> References: <1447005681-4912-1-git-send-email-peter@hurleysoftware.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1201 Lines: 45 WARN() does all of these things in one statement. Signed-off-by: Peter Hurley --- drivers/tty/tty_mutex.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c index 0efcf71..77703a3 100644 --- a/drivers/tty/tty_mutex.c +++ b/drivers/tty/tty_mutex.c @@ -12,11 +12,8 @@ void __lockfunc tty_lock(struct tty_struct *tty) { - if (tty->magic != TTY_MAGIC) { - pr_err("L Bad %p\n", tty); - WARN_ON(1); + if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty)) return; - } tty_kref_get(tty); mutex_lock(&tty->legacy_mutex); } @@ -24,11 +21,8 @@ EXPORT_SYMBOL(tty_lock); void __lockfunc tty_unlock(struct tty_struct *tty) { - if (tty->magic != TTY_MAGIC) { - pr_err("U Bad %p\n", tty); - WARN_ON(1); + if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty)) return; - } mutex_unlock(&tty->legacy_mutex); tty_kref_put(tty); } -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/