drivers/spi: move a dereference below a NULL test
authorJulia Lawall <julia@diku.dk>
Tue, 6 Jan 2009 22:41:45 +0000 (14:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:20 +0000 (15:59 -0800)
commit51e911e27690aecea01d4fe9cb22d38bdd0748ac
tree0da60b105c3a74ac10a5e34ed9aa0a18af5673ef
parentee9c1fbfe130a20e0f23d1693d6427dac97239bc
drivers/spi: move a dereference below a NULL test

In each case, if the NULL test is necessary, then the dereference should be
moved below the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/spi/pxa2xx_spi.c