Merge tag 'thermal-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/therma...
[linux-2.6-microblaze.git] / drivers / tty / pty.c
index 00099a8..23368ce 100644 (file)
@@ -100,7 +100,7 @@ static void pty_unthrottle(struct tty_struct *tty)
  *     pty_write               -       write to a pty
  *     @tty: the tty we write from
  *     @buf: kernel buffer of data
- *     @count: bytes to write
+ *     @c: bytes to write
  *
  *     Our "hardware" write method. Data is coming from the ldisc which
  *     may be in a non sleeping state. We simply throw this at the other
@@ -120,10 +120,10 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
                spin_lock_irqsave(&to->port->lock, flags);
                /* Stuff the data into the input queue of the other end */
                c = tty_insert_flip_string(to->port, buf, c);
+               spin_unlock_irqrestore(&to->port->lock, flags);
                /* And shovel */
                if (c)
                        tty_flip_buffer_push(to->port);
-               spin_unlock_irqrestore(&to->port->lock, flags);
        }
        return c;
 }