public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 12/14] arch/arm/plat-omap: Drop an unnecessary NULL test
@ 2009-10-17  6:42 Julia Lawall
  2009-11-12 22:15 ` [APPLIED] " Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-10-17  6:42 UTC (permalink / raw)
  To: tony, Russell King, linux-omap, linux-arm-kernel, linux-kernel,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>

map_iovm_area is only called from a context where its second argument is
known not to be NULL, so drop the unnecessary test.  If new could be NULL,
the initialization of da should be moved below the test.

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>

---
 arch/arm/plat-omap/iovmm.c          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index dc3fac3..21c73d4 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -449,7 +449,7 @@ static int map_iovm_area(struct iommu *obj, struct iovm_struct *new,
 	struct scatterlist *sg;
 	u32 da = new->da_start;
 
-	if (!obj || !new || !sgt)
+	if (!obj || !sgt)
 		return -EINVAL;
 
 	BUG_ON(!sgtable_ok(sgt));

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-12 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-17  6:42 [PATCH 12/14] arch/arm/plat-omap: Drop an unnecessary NULL test Julia Lawall
2009-11-12 22:15 ` [APPLIED] " Tony Lindgren

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