[PATCH 4.14 100/159] optee: fix invalid of_node_put() in optee_driver_init()

From: Greg Kroah-Hartman
Date: Fri Dec 22 2017 - 04:33:31 EST


4.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jens Wiklander <jens.wiklander@xxxxxxxxxx>

commit f044113113dd95ba73916bde10e804d3cdfa2662 upstream.

The first node supplied to of_find_matching_node() has its reference
counter decreased as part of call to that function. In optee_driver_init()
after calling of_find_matching_node() it's invalid to call of_node_put() on
the supplied node again.

So remove the invalid call to of_node_put().

Reported-by: Alex Shi <alex.shi@xxxxxxxxxx>
Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
Cc: <andi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/tee/optee/core.c | 1 -
1 file changed, 1 deletion(-)

--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -590,7 +590,6 @@ static int __init optee_driver_init(void
return -ENODEV;

np = of_find_matching_node(fw_np, optee_match);
- of_node_put(fw_np);
if (!np)
return -ENODEV;