Commit 6d029c68 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

tty: Merge conditional + error message + WARN_ON()

WARN() does all of these things in one statement.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d435cefe
...@@ -12,11 +12,8 @@ ...@@ -12,11 +12,8 @@
void __lockfunc tty_lock(struct tty_struct *tty) void __lockfunc tty_lock(struct tty_struct *tty)
{ {
if (tty->magic != TTY_MAGIC) { if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty))
pr_err("L Bad %p\n", tty);
WARN_ON(1);
return; return;
}
tty_kref_get(tty); tty_kref_get(tty);
mutex_lock(&tty->legacy_mutex); mutex_lock(&tty->legacy_mutex);
} }
...@@ -24,11 +21,8 @@ EXPORT_SYMBOL(tty_lock); ...@@ -24,11 +21,8 @@ EXPORT_SYMBOL(tty_lock);
void __lockfunc tty_unlock(struct tty_struct *tty) void __lockfunc tty_unlock(struct tty_struct *tty)
{ {
if (tty->magic != TTY_MAGIC) { if (WARN(tty->magic != TTY_MAGIC, "U Bad %p\n", tty))
pr_err("U Bad %p\n", tty);
WARN_ON(1);
return; return;
}
mutex_unlock(&tty->legacy_mutex); mutex_unlock(&tty->legacy_mutex);
tty_kref_put(tty); tty_kref_put(tty);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment