Skip to content

Commit c7c0d8d

Browse files
JuliaLawalljenswi-linaro
authored andcommitted
tee: optee: add missing of_node_put after of_device_is_available
Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // </smpl> Fixes: db878f7 ("tee: optee: take DT status property into account") Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
1 parent 49a5785 commit c7c0d8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/tee/optee/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,10 @@ static int __init optee_driver_init(void)
699699
return -ENODEV;
700700

701701
np = of_find_matching_node(fw_np, optee_match);
702-
if (!np || !of_device_is_available(np))
702+
if (!np || !of_device_is_available(np)) {
703+
of_node_put(np);
703704
return -ENODEV;
705+
}
704706

705707
optee = optee_probe(np);
706708
of_node_put(np);

0 commit comments

Comments
 (0)