diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-11-08 19:01:20 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-14 04:59:48 +0100 |
commit | 6d029c68de1219ed791b484d0d289562a51520c7 (patch) | |
tree | d1924f7de946dab119182a0b5ae8ebb8e2282def /drivers/tty | |
parent | tty: Remove __func__ from tty_debug() macro (diff) | |
download | linux-6d029c68de1219ed791b484d0d289562a51520c7.tar.xz linux-6d029c68de1219ed791b484d0d289562a51520c7.zip |
tty: Merge conditional + error message + WARN_ON()
WARN() does all of these things in one statement.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/tty_mutex.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c index 0efcf713b756..77703a391207 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); } |