@r@
local idexpression n;
position p1;
@@
n = \(of_find_node_by_name@p1\|of_find_node_by_type@p1\|of_find_node_by_path@p1\|of_find_node_by_phandle@p1\|of_find_matching_node@p1\|of_find_compatible_node@p1\)(...)
@t exists@
local idexpression n;
statement S1;
expression E;
expression *ptr != NULL;
type T;
position r.p1,p2;
@@
(
if ((n = \(of_find_node_by_name@p1\|of_find_node_by_type@p1\|of_find_node_by_path@p1\|of_find_node_by_phandle@p1\|of_find_matching_node@p1\|of_find_compatible_node@p1\)(...)) == NULL) S1
|
n = \(of_find_node_by_name@p1\|of_find_node_by_type@p1\|of_find_node_by_path@p1\|of_find_node_by_phandle@p1\|of_find_matching_node@p1\|of_find_compatible_node@p1\)(...)
)
... when != of_node_put(n)
when != if (...) { <+... of_node_put(n) ...+> }
when != true n == NULL || ...
when != n = (T)E
when != E = n
(
return \(0\|<+...n...+>\|ptr\);
|
return@p2 ...;
)
@s@
local idexpression n;
statement S1,S2;
expression E,E1;
expression *ptr != NULL;
type T,T1;
identifier l1,l2;
position r.p1;
@@
(
if ((n = \(of_find_node_by_name@p1\|of_find_node_by_type@p1\|of_find_node_by_path@p1\|of_find_node_by_phandle@p1\|of_find_matching_node@p1\|of_find_compatible_node@p1\)(...)) == NULL) S1
|
n = \(of_find_node_by_name@p1\|of_find_node_by_type@p1\|of_find_node_by_path@p1\|of_find_node_by_phandle@p1\|of_find_matching_node@p1\|of_find_compatible_node@p1\)(...)
)
<... when != of_node_put(n)
when != if (...) { <+... of_node_put(n) ...+> }
when != true n == NULL || ...
when != n = (T)E
when != E = n
when != goto l1;
if (n == NULL || ...) S2
...>
(
return \(0\|<+...n...+>\|ptr\);
|
+ of_node_put(n);
return ...;
|
of_node_put(n);
|
n = (T1)E1
|
E1 = n
|
goto l2;
)
@script:python depends on !s@
p1 << r.p1;
p2 << t.p2;
@@
print "* file: %s of_find_node_by_name, etc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)