>
> From: Julia Lawall <julia@diku.dk>
>=20
> of_node_put is needed before discarding a value received from
> of_find_node_by_name, eg in error handling code.
>=20
> The semantic patch that makes the change is as follows:
> (
http://www.emn.fr/x-info/coccinelle/)
>=20
> // <smpl>
> @@
> struct device_node *n;
> struct device_node *n1;
> statement S;
> identifier f;
> expression E;
> constant C;
> @@
>=20
> n =3D of_find_node_by_name(...)
> ...
> if (!n) S
> ... when !=3D of_node_put(n)
> when !=3D n1 =3D f(n,...)
> when !=3D E =3D n
> when any
> when strict
> (
> + of_node_put(n);
> return -C;
> |
> of_node_put(n);
> |
> n1 =3D f(n,...)
> |
> E =3D n
> |
> return ...;
> )
> // </smpl>
>=20
> Signed-off-by: Julia Lawall <julia@diku.dk>