aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2015-11-08 13:01:20 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-13 22:59:48 -0500
commit6d029c68de1219ed791b484d0d289562a51520c7 (patch)
treed1924f7de946dab119182a0b5ae8ebb8e2282def /drivers/tty
parentd435cefe9cbc9308cac8d4b19069a572e2bd1558 (diff)
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.c10
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 @@
12 12
13void __lockfunc tty_lock(struct tty_struct *tty) 13void __lockfunc tty_lock(struct tty_struct *tty)
14{ 14{
15 if (tty->magic != TTY_MAGIC) { 15 if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty))
16 pr_err("L Bad %p\n", tty);
17 WARN_ON(1);
18 return; 16 return;
19 }
20 tty_kref_get(tty); 17 tty_kref_get(tty);
21 mutex_lock(&tty->legacy_mutex); 18 mutex_lock(&tty->legacy_mutex);
22} 19}
@@ -24,11 +21,8 @@ EXPORT_SYMBOL(tty_lock);
24 21
25void __lockfunc tty_unlock(struct tty_struct *tty) 22void __lockfunc tty_unlock(struct tty_struct *tty)
26{ 23{
27 if (tty->magic != TTY_MAGIC) { 24 if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty))
28 pr_err("U Bad %p\n", tty);
29 WARN_ON(1);
30 return; 25 return;
31 }
32 mutex_unlock(&tty->legacy_mutex); 26 mutex_unlock(&tty->legacy_mutex);
33 tty_kref_put(tty); 27 tty_kref_put(tty);
34} 28}