Commit 326f28e9ec4b2619c2fd410593fc95fcb0ba6b41

Authored by Eric Sesterhenn
Committed by Linus Torvalds
1 parent fa791f5bdf

[PATCH] More !tty cleanups in drivers/char

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>

Showing 5 changed files with 10 additions and 10 deletions Side-by-side Diff

drivers/char/isicom.c
... ... @@ -1145,7 +1145,7 @@
1145 1145 if (isicom_paranoia_check(port, tty->name, "isicom_write"))
1146 1146 return 0;
1147 1147  
1148   - if (!tty || !port->xmit_buf)
  1148 + if (!port->xmit_buf)
1149 1149 return 0;
1150 1150  
1151 1151 spin_lock_irqsave(&card->card_lock, flags);
... ... @@ -1180,7 +1180,7 @@
1180 1180 if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
1181 1181 return;
1182 1182  
1183   - if (!tty || !port->xmit_buf)
  1183 + if (!port->xmit_buf)
1184 1184 return;
1185 1185  
1186 1186 spin_lock_irqsave(&card->card_lock, flags);
drivers/char/pcmcia/synclink_cs.c
... ... @@ -1582,7 +1582,7 @@
1582 1582 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char"))
1583 1583 return;
1584 1584  
1585   - if (!tty || !info->tx_buf)
  1585 + if (!info->tx_buf)
1586 1586 return;
1587 1587  
1588 1588 spin_lock_irqsave(&info->lock,flags);
... ... @@ -1649,7 +1649,7 @@
1649 1649 __FILE__,__LINE__,info->device_name,count);
1650 1650  
1651 1651 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") ||
1652   - !tty || !info->tx_buf)
  1652 + !info->tx_buf)
1653 1653 goto cleanup;
1654 1654  
1655 1655 if (info->params.mode == MGSL_MODE_HDLC) {
drivers/char/specialix.c
... ... @@ -1683,7 +1683,7 @@
1683 1683  
1684 1684 bp = port_Board(port);
1685 1685  
1686   - if (!tty || !port->xmit_buf || !tmp_buf) {
  1686 + if (!port->xmit_buf || !tmp_buf) {
1687 1687 func_exit();
1688 1688 return 0;
1689 1689 }
... ... @@ -1733,7 +1733,7 @@
1733 1733 return;
1734 1734 }
1735 1735 dprintk (SX_DEBUG_TX, "check tty: %p %p\n", tty, port->xmit_buf);
1736   - if (!tty || !port->xmit_buf) {
  1736 + if (!port->xmit_buf) {
1737 1737 func_exit();
1738 1738 return;
1739 1739 }
drivers/char/synclink_gt.c
... ... @@ -870,7 +870,7 @@
870 870 goto cleanup;
871 871 DBGINFO(("%s write count=%d\n", info->device_name, count));
872 872  
873   - if (!tty || !info->tx_buf)
  873 + if (!info->tx_buf)
874 874 goto cleanup;
875 875  
876 876 if (count > info->max_frame_size) {
... ... @@ -924,7 +924,7 @@
924 924 if (sanity_check(info, tty->name, "put_char"))
925 925 return;
926 926 DBGINFO(("%s put_char(%d)\n", info->device_name, ch));
927   - if (!tty || !info->tx_buf)
  927 + if (!info->tx_buf)
928 928 return;
929 929 spin_lock_irqsave(&info->lock,flags);
930 930 if (!info->tx_active && (info->tx_count < info->max_frame_size))
drivers/char/synclinkmp.c
... ... @@ -988,7 +988,7 @@
988 988 if (sanity_check(info, tty->name, "write"))
989 989 goto cleanup;
990 990  
991   - if (!tty || !info->tx_buf)
  991 + if (!info->tx_buf)
992 992 goto cleanup;
993 993  
994 994 if (info->params.mode == MGSL_MODE_HDLC) {
... ... @@ -1067,7 +1067,7 @@
1067 1067 if (sanity_check(info, tty->name, "put_char"))
1068 1068 return;
1069 1069  
1070   - if (!tty || !info->tx_buf)
  1070 + if (!info->tx_buf)
1071 1071 return;
1072 1072  
1073 1073 spin_lock_irqsave(&info->lock,flags);