Skip to contentSkip to conversation

arch/arm/plat-omap: Drop an unnecessary NULL test

PATCH Applied Julia Lawall 2 participants 2 messages Oct 17, 2009 – Nov 12, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 12/14 arch/arm/plat-omap: Drop an unnecessary NULL test

From: Julia Lawall <[email protected]>

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>

---
 arch/arm/plat-omap/iovmm.c          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/iovmm.c +1 -1
index dc3fac3..21c73d4 100644
@@ -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));
#1 lore raw

PATCH 12/14 arch/arm/plat-omap: Drop an unnecessary NULL test

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-testing

Initial commit ID (Likely to change): d067810bbe621c19ab96e913877c90b1b2e8bcc1

PatchWorks
http://patchwork.kernel.org/patch/54504/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=d067810bbe621c19ab96e913877c90b1b2e8bcc1