kernel_optimize_test/drivers/macintosh
Nicolas Palix 44ea9c809d drivers/macintosh: Add missing of_node_put in therm_adt746x.c
of_node_put is needed before discarding a value received from
of_find_node_by_name, eg in error handling code or when the device node is
no longer used.

The semantic match that catches the bug is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression struct device_node *n;
position p1, p2;
struct device_node *n1;
statement S;
identifier f;
expression E;
expression *ptr != NULL;
@@

n@p1 = of_find_node_by_name(...)
...
if (!n) S
... when != of_node_put(n)
    when != n1 = f(n,...)
    when != E = n
    when any
    when strict
(
  return \(0\|<+...n...+>\|ptr\);
|
return@p2 ...;
|
  of_node_put(n);
|
  n1 = f(n,...)
|
  E = n
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s of_find_node_by_name %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Nicolas Palix <npalix@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06 15:59:18 -08:00
..
adb-iop.c
adb.c device create: misc: convert device_create_drvdata to device_create 2008-10-16 09:24:43 -07:00
adbhid.c Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into next 2008-07-21 00:55:14 -04:00
ans-lcd.c ans-lcd: BKL pushdown 2008-06-20 14:05:54 -06:00
ans-lcd.h
apm_emu.c
Kconfig [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
mac_hid.c mac-hid: fix build after lockdep annotation 2008-04-25 18:57:09 -07:00
macio_asic.c
macio_sysfs.c [POWERPC] Create modalias file in sysfs for of_platform bus 2008-05-14 22:31:28 +10:00
macio-adb.c
Makefile [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
mediabay.c remove unnecessary <linux/hdreg.h> includes 2008-08-05 18:16:58 +02:00
nvram.c
rack-meter.c rackmeter section fixes 2008-11-30 10:03:37 -08:00
smu.c Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build 2008-07-15 15:44:51 +10:00
therm_adt746x.c drivers/macintosh: Add missing of_node_put in therm_adt746x.c 2009-01-06 15:59:18 -08:00
therm_pm72.c macintosh: Use linux/of_{device,platform}.h instead of asm 2008-06-30 22:30:33 +10:00
therm_pm72.h
therm_windtunnel.c macintosh/therm_windtunnel: Convert semaphore to mutex 2008-06-30 22:30:46 +10:00
via-cuda.c m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
via-macii.c m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
via-maciisi.c m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
via-pmu-backlight.c
via-pmu-event.c
via-pmu-event.h
via-pmu-led.c
via-pmu.c powerpc/mm: Split mmu_context handling 2008-12-21 14:21:15 +11:00
via-pmu68k.c m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
windfarm_core.c
windfarm_cpufreq_clamp.c
windfarm_lm75_sensor.c [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
windfarm_max6690_sensor.c [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
windfarm_pid.c
windfarm_pid.h
windfarm_pm81.c
windfarm_pm91.c
windfarm_pm112.c
windfarm_pm121.c [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
windfarm_smu_controls.c [POWERPC] windfarm: Add PowerMac 12,1 support 2008-04-29 15:57:35 +10:00
windfarm_smu_sat.c powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_partition() 2008-12-03 21:04:02 +11:00
windfarm_smu_sensors.c
windfarm.h