Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscom8: remove bogus checks

Chris Malley posted a patch removing a NULL check in the riscom8 driver.
Further analysis shows that even more of the tests are irrelevant so we
can delete lots of stuff

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
d99101fd 85f8f810

+8 -24
+8 -24
drivers/char/riscom8.c
··· 638 638 unsigned char cor1 = 0, cor3 = 0; 639 639 unsigned char mcor1 = 0, mcor2 = 0; 640 640 641 - if (tty == NULL || tty->termios == NULL) 642 - return; 643 - 644 641 port->IER = 0; 645 642 port->COR2 = 0; 646 643 port->MSVR = MSVR_RTS; ··· 791 794 792 795 spin_lock_irqsave(&riscom_lock, flags); 793 796 794 - if (port->port.tty) 795 - clear_bit(TTY_IO_ERROR, &port->port.tty->flags); 797 + clear_bit(TTY_IO_ERROR, &port->port.tty->flags); 796 798 if (port->port.count == 1) 797 799 bp->count++; 798 800 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; ··· 803 807 } 804 808 805 809 /* Must be called with interrupts disabled */ 806 - static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) 810 + static void rc_shutdown_port(struct tty_struct *tty, 811 + struct riscom_board *bp, struct riscom_port *port) 807 812 { 808 - struct tty_struct *tty; 809 - 810 813 if (!(port->port.flags & ASYNC_INITIALIZED)) 811 814 return; 812 815 ··· 825 830 } 826 831 #endif 827 832 tty_port_free_xmit_buf(&port->port); 828 - 829 - tty = port->port.tty; 830 - 831 - if (tty == NULL || C_HUPCL(tty)) { 833 + if (C_HUPCL(tty)) { 832 834 /* Drop DTR */ 833 835 bp->DTR |= (1u << port_No(port)); 834 836 rc_out(bp, RC_DTR, bp->DTR); ··· 840 848 port->IER = 0; 841 849 rc_out(bp, CD180_IER, port->IER); 842 850 843 - if (tty) 844 - set_bit(TTY_IO_ERROR, &tty->flags); 851 + set_bit(TTY_IO_ERROR, &tty->flags); 845 852 port->port.flags &= ~ASYNC_INITIALIZED; 846 853 847 854 if (--bp->count < 0) { ··· 1058 1067 break; 1059 1068 } 1060 1069 } 1061 - rc_shutdown_port(bp, port); 1070 + rc_shutdown_port(tty, bp, port); 1062 1071 rc_flush_buffer(tty); 1063 1072 tty_ldisc_flush(tty); 1064 1073 ··· 1088 1097 return 0; 1089 1098 1090 1099 bp = port_Board(port); 1091 - 1092 - if (!tty || !port->port.xmit_buf) 1093 - return 0; 1094 1100 1095 1101 while (1) { 1096 1102 spin_lock_irqsave(&riscom_lock, flags); ··· 1129 1141 if (rc_paranoia_check(port, tty->name, "rc_put_char")) 1130 1142 return 0; 1131 1143 1132 - if (!tty || !port->port.xmit_buf) 1133 - return 0; 1134 - 1135 1144 spin_lock_irqsave(&riscom_lock, flags); 1136 1145 1137 1146 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) ··· 1152 1167 if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) 1153 1168 return; 1154 1169 1155 - if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 1156 - !port->port.xmit_buf) 1170 + if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped) 1157 1171 return; 1158 1172 1159 1173 spin_lock_irqsave(&riscom_lock, flags); ··· 1472 1488 1473 1489 bp = port_Board(port); 1474 1490 1475 - rc_shutdown_port(bp, port); 1491 + rc_shutdown_port(tty, bp, port); 1476 1492 port->port.count = 0; 1477 1493 port->port.flags &= ~ASYNC_NORMAL_ACTIVE; 1478 1494 port->port.tty = NULL;