Skip to contentSkip to conversation

riscom8: remove redundant null pointer test

PATCH In review Chris Malley 2 participants 2 messages May 12, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscom8: remove redundant null pointer test

tty has already been dereferenced at least twice in these functions, so checking for null here seems a bit unnecessary.

---
 drivers/char/riscom8.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/riscom8.c +2 -2
index f073c71..9643a49 100644
@@ -1108,7 +1108,7 @@ static int rc_write(struct tty_struct *tty,
 
 	bp = port_Board(port);
 
-	if (!tty || !port->xmit_buf)
+	if (!port->xmit_buf)
 		return 0;
 
 	while (1) {
@@ -1151,7 +1151,7 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch)
 	if (rc_paranoia_check(port, tty->name, "rc_put_char"))
 		return 0;
 
-	if (!tty || !port->xmit_buf)
+	if (!port->xmit_buf)
 		return 0;
 
 	spin_lock_irqsave(&riscom_lock, flags);
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · On Mon, 12 May 2008 19:27:10 +0100 Chris Malley <[email protected]> wrote:

tty has already been dereferenced at least twice in these functions, so checking for null here seems a bit unnecessary.

Oh it is - and lots of the other tty checks are bogus too.

Alan