n_tty: Simplify __receive_buf loop count
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 15 Jun 2013 14:21:21 +0000 (10:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jul 2013 00:08:40 +0000 (17:08 -0700)
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c

index d598436d9bc6463331c102f4327f49055afed01f..4f20bec011fb671aa3bbd0874d30a86129814552 100644 (file)
@@ -1505,21 +1505,19 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
                memcpy(read_buf_addr(ldata, head), cp, n);
                ldata->read_head += n;
        } else {
-               int i;
-
-               for (i = count; i; i--, cp++) {
+               while (count--) {
                        if (fp)
                                flags = *fp++;
                        switch (flags) {
                        case TTY_NORMAL:
-                               n_tty_receive_char(tty, *cp);
+                               n_tty_receive_char(tty, *cp++);
                                break;
                        case TTY_BREAK:
                                n_tty_receive_break(tty);
                                break;
                        case TTY_PARITY:
                        case TTY_FRAME:
-                               n_tty_receive_parity_error(tty, *cp);
+                               n_tty_receive_parity_error(tty, *cp++);
                                break;
                        case TTY_OVERRUN:
                                n_tty_receive_overrun(tty);