tty: Finish fixing up the init_dev interface to use ERR_PTR
Original suggestion and proposal from Sukadev Bhattiprolu.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 4e6490b..c984500 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -501,11 +501,13 @@
return index;
mutex_lock(&tty_mutex);
- retval = tty_init_dev(ptm_driver, index, &tty, 1);
+ tty = tty_init_dev(ptm_driver, index, 1);
mutex_unlock(&tty_mutex);
- if (retval)
+ if (IS_ERR(tty)) {
+ retval = PTR_ERR(tty);
goto out;
+ }
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
filp->private_data = tty;