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>
This commit is contained in:
parent
d435cefe9c
commit
6d029c68de
1 changed files with 2 additions and 8 deletions
|
@ -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);
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue