ACPI: Move dereference after NULL test
authorJulia Lawall <julia@diku.dk>
Sat, 17 Oct 2009 06:34:39 +0000 (08:34 +0200)
committerLen Brown <len.brown@intel.com>
Thu, 5 Nov 2009 22:30:57 +0000 (17:30 -0500)
commit5cfa245b0b63c3d79568e78a1ee3d00654d5517d
tree161590c73691e744b176decedd41504d4de6f4c4
parent941b10fab2cbd90ac7ad6bc2338ffe30e1d3ce53
ACPI: Move dereference after NULL test

If the NULL test on pr is needed, then the dereference 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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/processor_throttling.c