1
0
Fork 0

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>
hifive-unleashed-5.1
Peter Hurley 2015-11-08 13:01:20 -05:00 committed by Greg Kroah-Hartman
parent d435cefe9c
commit 6d029c68de
1 changed files with 2 additions and 8 deletions

View File

@ -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);
}