[PATCH] More !tty cleanups in drivers/char
authorEric Sesterhenn <snakebyte@gmx.de>
Sun, 25 Jun 2006 12:48:48 +0000 (05:48 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 25 Jun 2006 17:01:19 +0000 (10:01 -0700)
Another bunch of checks in the char drivers .put_char() and .write()
routines, where tty can never be NULL.  This patch removes these checks to
save some code.  Coverity choked at those with the following bug ids:

isicom.c  767, 766
specialix.c 773, 774
synclink_cs.c 779, 781
synclink_gt.c 784, 785
synclinkmp.c 784, 785

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/isicom.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/specialix.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c

index e9ebaba..efaaa19 100644 (file)
@@ -1145,7 +1145,7 @@ static int isicom_write(struct tty_struct *tty,   const unsigned char *buf,
        if (isicom_paranoia_check(port, tty->name, "isicom_write"))
                return 0;
 
-       if (!tty || !port->xmit_buf)
+       if (!port->xmit_buf)
                return 0;
 
        spin_lock_irqsave(&card->card_lock, flags);
@@ -1180,7 +1180,7 @@ static void isicom_put_char(struct tty_struct *tty, unsigned char ch)
        if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
                return;
 
-       if (!tty || !port->xmit_buf)
+       if (!port->xmit_buf)
                return;
 
        spin_lock_irqsave(&card->card_lock, flags);
index 0c141c2..17bc8ab 100644 (file)
@@ -1582,7 +1582,7 @@ static void mgslpc_put_char(struct tty_struct *tty, unsigned char ch)
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char"))
                return;
 
-       if (!tty || !info->tx_buf)
+       if (!info->tx_buf)
                return;
 
        spin_lock_irqsave(&info->lock,flags);
@@ -1649,7 +1649,7 @@ static int mgslpc_write(struct tty_struct * tty,
                        __FILE__,__LINE__,info->device_name,count);
        
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") ||
-           !tty || !info->tx_buf)
+               !info->tx_buf)
                goto cleanup;
 
        if (info->params.mode == MGSL_MODE_HDLC) {
index 5343e9f..1b53302 100644 (file)
@@ -1683,7 +1683,7 @@ static int sx_write(struct tty_struct * tty,
 
        bp = port_Board(port);
 
-       if (!tty || !port->xmit_buf || !tmp_buf) {
+       if (!port->xmit_buf || !tmp_buf) {
                func_exit();
                return 0;
        }
@@ -1733,7 +1733,7 @@ static void sx_put_char(struct tty_struct * tty, unsigned char ch)
                return;
        }
        dprintk (SX_DEBUG_TX, "check tty: %p %p\n", tty, port->xmit_buf);
-       if (!tty || !port->xmit_buf) {
+       if (!port->xmit_buf) {
                func_exit();
                return;
        }
index b4d1f4e..b4f1a5a 100644 (file)
@@ -870,7 +870,7 @@ static int write(struct tty_struct *tty,
                goto cleanup;
        DBGINFO(("%s write count=%d\n", info->device_name, count));
 
-       if (!tty || !info->tx_buf)
+       if (!info->tx_buf)
                goto cleanup;
 
        if (count > info->max_frame_size) {
@@ -924,7 +924,7 @@ static void put_char(struct tty_struct *tty, unsigned char ch)
        if (sanity_check(info, tty->name, "put_char"))
                return;
        DBGINFO(("%s put_char(%d)\n", info->device_name, ch));
-       if (!tty || !info->tx_buf)
+       if (!info->tx_buf)
                return;
        spin_lock_irqsave(&info->lock,flags);
        if (!info->tx_active && (info->tx_count < info->max_frame_size))
index 8587401..21bf15a 100644 (file)
@@ -988,7 +988,7 @@ static int write(struct tty_struct *tty,
        if (sanity_check(info, tty->name, "write"))
                goto cleanup;
 
-       if (!tty || !info->tx_buf)
+       if (!info->tx_buf)
                goto cleanup;
 
        if (info->params.mode == MGSL_MODE_HDLC) {
@@ -1067,7 +1067,7 @@ static void put_char(struct tty_struct *tty, unsigned char ch)
        if (sanity_check(info, tty->name, "put_char"))
                return;
 
-       if (!tty || !info->tx_buf)
+       if (!info->tx_buf)
                return;
 
        spin_lock_irqsave(&info->lock,flags);