Commit 8e1dea50 authored by Julia Lawall's avatar Julia Lawall Committed by james toy

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: default avatarJulia Lawall <julia@diku.dk>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5cd88d69
...@@ -446,7 +446,7 @@ static int map_iovm_area(struct iommu *obj, struct iovm_struct *new, ...@@ -446,7 +446,7 @@ static int map_iovm_area(struct iommu *obj, struct iovm_struct *new,
struct scatterlist *sg; struct scatterlist *sg;
u32 da = new->da_start; u32 da = new->da_start;
if (!obj || !new || !sgt) if (!obj || !sgt)
return -EINVAL; return -EINVAL;
BUG_ON(!sgtable_ok(sgt)); BUG_ON(!sgtable_ok(sgt));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment