drivers/mmc: Move dereference after NULL test
authorJulia Lawall <julia@diku.dk>
Tue, 15 Dec 2009 02:01:20 +0000 (18:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Dec 2009 16:53:34 +0000 (08:53 -0800)
commit3423d80af67a94a641cc3297ec8c0869aa7f197c
tree79c40fb875c0145598e05d3e7dfb93fd208a3f3b
parent4ec64960653c91fa86373d06a079eb7a63deb21f
drivers/mmc: Move dereference after NULL test

If the NULL test on mrq is needed, then the derefernce should be after the
NULL 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: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/mmc/host/s3cmci.c