kernel_optimize_test/drivers/misc
Julia Lawall 3a8ca95e9d drivers/misc: elide a non-zero test on a result that is never 0
The function thermal_cooling_device_register always returns either a valid
pointer or a value made with ERR_PTR, so a test for non-zero on the result
will always succeed.

The problem was found using the following semantic match.
(http://www.emn.fr/x-info/coccinelle/)

//<smpl>
@a@
expression E, E1;
statement S,S1;
position p;
@@

E = thermal_cooling_device_register(...)
... when != E = E1
if@p (E) S else S1

@n@
position a.p;
expression E,E1;
statement S,S1;
@@

E = NULL
... when != E = E1
if@p (E) S else S1

@depends on !n@
expression E;
statement S,S1;
position a.p;
@@

* if@p (E)
  S else S1
//</smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Thomas Sujith <sujith.thomas@intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:04 -07:00
..
hdpuftrs misc: fix platform driver hotplug/coldplug 2008-04-15 19:35:40 -07:00
ibmasm drivers/misc: replace remaining __FUNCTION__ occurrences 2008-04-29 08:06:03 -07:00
sgi-xp [IA64] run drivers/misc/sgi-xp through scripts/checkpatch.pl 2008-04-22 15:08:55 -07:00
acer-wmi.c Merge branches 'release', 'ejd', 'sony' and 'wmi' into release 2008-03-13 01:59:52 -04:00
asus-laptop.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2008-02-07 09:45:58 -08:00
atmel_pwm.c misc: fix platform driver hotplug/coldplug 2008-04-15 19:35:40 -07:00
atmel_tclib.c atmel_tc library 2008-03-04 13:41:23 +01:00
atmel-ssc.c misc: fix platform driver hotplug/coldplug 2008-04-15 19:35:40 -07:00
eeprom_93cx6.c eeprom_93cx6: shorten pulse timing to match spec (bis) 2007-07-10 12:41:09 -04:00
enclosure.c [SCSI] ses: fix up functionality after class_device->device conversion 2008-04-22 15:16:29 -05:00
fujitsu-laptop.c NULL noise: drivers/misc 2008-03-30 14:18:41 -07:00
intel_menlow.c drivers/misc: elide a non-zero test on a result that is never 0 2008-04-29 08:06:04 -07:00
ioc4.c drivers/misc: replace remaining __FUNCTION__ occurrences 2008-04-29 08:06:03 -07:00
Kconfig [IA64] move XP and XPC to drivers/misc/sgi-xp 2008-04-22 15:08:17 -07:00
kgdbts.c kgdb: allow static kgdbts boot configuration 2008-04-17 20:05:43 +02:00
lkdtm.c NULL noise: drivers/misc 2008-03-30 14:18:41 -07:00
Makefile [IA64] move XP and XPC to drivers/misc/sgi-xp 2008-04-22 15:08:17 -07:00
msi-laptop.c Remove inclusions of <linux/autoconf.h> 2008-02-06 10:41:00 -08:00
phantom.c Misc, phantom, fix poll 2008-04-29 08:06:02 -07:00
sony-laptop.c drivers/misc: replace remaining __FUNCTION__ occurrences 2008-04-29 08:06:03 -07:00
tc1100-wmi.c tc1100-wmi: Add driver for HP Compaq TC1100 Tablets 2008-02-05 15:07:16 -05:00
thinkpad_acpi.c ACPI: thinkpad-acpi: fix hotkey_get_tablet_mode 2008-03-04 16:35:16 -08:00
tifm_7xx1.c tifm: clear interrupt mask bits before setting them on adapter init 2008-03-10 18:01:18 -07:00
tifm_core.c memstick: initial commit for Sony MemoryStick support 2008-02-09 11:08:34 -08:00