OpenCloudOS-Kernel/drivers/cpuidle
Julia Lawall faa7b7ddca drivers/cpuidle: Move dereference after NULL test
It does not seem possible that ldev can be NULL, so drop the unnecessary
test.  If ldev can somehow be NULL, then the initialization of last_idx
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>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:25 -08:00
..
governors drivers/cpuidle: Move dereference after NULL test 2009-12-15 08:53:25 -08:00
Kconfig ACPI: CONFIG_CPU_IDLE=ACPI by default 2007-11-19 22:22:37 -05:00
Makefile cpuidle: consolidate 2.6.22 cpuidle branch into one patch 2007-10-10 00:12:41 -04:00
cpuidle.c cpuidle: always return with interrupts enabled 2009-10-29 07:39:31 -07:00
cpuidle.h cpuidle: consolidate 2.6.22 cpuidle branch into one patch 2007-10-10 00:12:41 -04:00
driver.c cpuidle: consolidate 2.6.22 cpuidle branch into one patch 2007-10-10 00:12:41 -04:00
governor.c tree-wide: fix typos "aquire" -> "acquire", "cumsumed" -> "consumed" 2009-11-09 09:40:57 +01:00
sysfs.c cpuidle: make sysfs attributes sysdev class attributes 2008-08-12 16:07:28 -07:00