Date: Mon, 27 Jul 2009 18:12:53 +0200 (CEST) From: Julia Lawall To: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/12] drivers/char: Correct redundant test dc was tested for NULL at the beginning of the function, in which case the function returns. dc does not seem to be updated in the meantime, so the second test is unnecessary. I have assumed that the comment, "notify card" goes with the code below it. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; @@ if (x@ == NULL || ...) { ... when forall return ...; } ... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\) ( *x == NULL | *x != NULL ) // Signed-off-by: Julia Lawall --- drivers/char/nozomi.c | 5 ----- 1 file changed, 5 deletions(-) Index: b/drivers/char/nozomi.c =================================================================== --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -1698,11 +1698,6 @@ static int ntty_write(struct tty_struct rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count); /* notify card */ - if (unlikely(dc == NULL)) { - DBG1("No device context?"); - goto exit; - } - spin_lock_irqsave(&dc->spin_mutex, flags); /* CTS is only valid on the modem channel */ if (port == &(dc->port[PORT_MDM])) {