Skip to content

Commit a6ca7e6

Browse files
javiercarrascocruzgeertu
authored andcommitted
clk: renesas: cpg-mssr: Fix 'soc' node handling in cpg_mssr_reserved_init()
A device_node reference obtained via of_find_node_by_path() requires explicit calls to of_node_put() after it is no longer required to avoid leaking the resource. Instead of adding the missing calls to of_node_put() in all execution paths, use the cleanup attribute for 'soc' by means of the __free() macro, which automatically calls of_node_put() when the variable goes out of scope. Fixes: 6aa1754 ("clk: renesas: cpg-mssr: Ignore all clocks assigned to non-Linux system") Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/20241031-clk-renesas-cpg-mssr-cleanup-v2-1-0010936d1154@gmail.com Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 40384c8 commit a6ca7e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/renesas/renesas-cpg-mssr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static void __init cpg_mssr_reserved_exit(struct cpg_mssr_priv *priv)
979979
static int __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
980980
const struct cpg_mssr_info *info)
981981
{
982-
struct device_node *soc = of_find_node_by_path("/soc");
982+
struct device_node *soc __free(device_node) = of_find_node_by_path("/soc");
983983
struct device_node *node;
984984
uint32_t args[MAX_PHANDLE_ARGS];
985985
unsigned int *ids = NULL;

0 commit comments

Comments
 (0)