Commit c882716b authored by Liang He's avatar Liang He Committed by Greg Kroah-Hartman

firmware: Hold a reference for of_find_compatible_node()

In of_register_trusted_foundations(), we need to hold the reference
returned by of_find_compatible_node() and then use it to call
of_node_put() for refcount balance.
Signed-off-by: default avatarLiang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220628021640.4015-1-windhl@126.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a244ec36
...@@ -71,12 +71,16 @@ static inline void register_trusted_foundations( ...@@ -71,12 +71,16 @@ static inline void register_trusted_foundations(
static inline void of_register_trusted_foundations(void) static inline void of_register_trusted_foundations(void)
{ {
struct device_node *np = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations");
if (!np)
return;
of_node_put(np);
/* /*
* If we find the target should enable TF but does not support it, * If we find the target should enable TF but does not support it,
* fail as the system won't be able to do much anyway * fail as the system won't be able to do much anyway
*/ */
if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations")) register_trusted_foundations(NULL);
register_trusted_foundations(NULL);
} }
static inline bool trusted_foundations_registered(void) static inline bool trusted_foundations_registered(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment