public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 13/17] drivers/scsi: Remove unnecessary NULL test
@ 2009-12-08 22:09 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2009-12-08 22:09 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, akpm, julia

From: Julia Lawall <julia@diku.dk>

At the point where cmnd is initialized, it is tested for NULL, so it
doesn't have to be tested again here.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// <smpl>
@match exists@
expression x, E;
identifier fld;
@@

* x->fld
  ... when != \(x = E\|&x\)
* x == NULL
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/scsi/initio.c |    1 -
 1 file changed, 1 deletion(-)

diff -puN drivers/scsi/initio.c~drivers-scsi-remove-unnecessary-null-test drivers/scsi/initio.c
--- a/drivers/scsi/initio.c~drivers-scsi-remove-unnecessary-null-test
+++ a/drivers/scsi/initio.c
@@ -2817,7 +2817,6 @@ static void i91uSCBPost(u8 * host_mem, u
 	}
 
 	cmnd->result = cblk->tastat | (cblk->hastat << 16);
-	WARN_ON(cmnd == NULL);
 	i91u_unmap_scb(host->pci_dev, cmnd);
 	cmnd->scsi_done(cmnd);	/* Notify system DONE           */
 	initio_release_scb(host, cblk);	/* Release SCB for current channel */
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-08 22:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 22:09 [patch 13/17] drivers/scsi: Remove unnecessary NULL test akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox