Skip to contentSkip to conversation

n_hdlc.c: fix check-after-use

PATCH New Adrian Bunk 1 participant 1 message Aug 27, 2007 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 n_hdlc.c: fix check-after-use

The Coverity checker spotted that we'd have already oops'ed if "tty" was NULL.

Since "tty" can't be NULL when we reach this line of code this patch removes the NULL check.

---

This patch has been sent on:
- 14 Aug 2007

drivers/char/n_hdlc.c renamed from drivers/char/n_hdlc.c.old +1 -1
@@ -220,25 +220,25 @@
 static void n_hdlc_release(struct n_hdlc *n_hdlc)
 {
 	struct tty_struct *tty = n_hdlc2tty (n_hdlc);
 	struct n_hdlc_buf *buf;
 	
 	if (debuglevel >= DEBUG_LEVEL_INFO)	
 		printk("%s(%d)n_hdlc_release() called\n",__FILE__,__LINE__);
 		
 	/* Ensure that the n_hdlcd process is not hanging on select()/poll() */
 	wake_up_interruptible (&tty->read_wait);
 	wake_up_interruptible (&tty->write_wait);
 
-	if (tty != NULL && tty->disc_data == n_hdlc)
+	if (tty->disc_data == n_hdlc)
 		tty->disc_data = NULL;	/* Break the tty->n_hdlc link */
 
 	/* Release transmit and receive buffers */
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->rx_free_buf_list);
 		if (buf) {
 			kfree(buf);
 		} else
 			break;
 	}
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list);