Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220628021640.4015-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Liang He and committed by
Greg Kroah-Hartman
c882716b a244ec36

+6 -2
+6 -2
include/linux/firmware/trusted_foundations.h
··· 71 71 72 72 static inline void of_register_trusted_foundations(void) 73 73 { 74 + struct device_node *np = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations"); 75 + 76 + if (!np) 77 + return; 78 + of_node_put(np); 74 79 /* 75 80 * If we find the target should enable TF but does not support it, 76 81 * fail as the system won't be able to do much anyway 77 82 */ 78 - if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations")) 79 - register_trusted_foundations(NULL); 83 + register_trusted_foundations(NULL); 80 84 } 81 85 82 86 static inline bool trusted_foundations_registered(void)