Skip to content

Commit

Permalink
arch/arm/plat-omap: Drop an unnecessary NULL test
Browse files Browse the repository at this point in the history
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>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Julia Lawall authored and Tony Lindgren committed Nov 22, 2009
1 parent 13a0322 commit 20e11c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/plat-omap/iovmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,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));
Expand Down

0 comments on commit 20e11c2

Please sign in to comment.