[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240820013550.4906-1-david.hunter.linux@gmail.com>
Date: Mon, 19 Aug 2024 21:35:49 -0400
From: David Hunter <david.hunter.linux@...il.com>
To: mturquette@...libre.com,
sboyd@...nel.org
Cc: linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org,
javier.carrasco.cruz@...il.com,
shuah@...nel.org,
david.hunter.linux@...il.com
Subject: [PATCH 1/1] Driver: clk-qoriq.c: replace of_node_put with _free improves cleanup
Use the _free function to have automatic clean up instead of calling
another function, of_node_put. This prevents leaking reference counts.
The following commit has information on _free(device_node):
9448e55d032d99af8e23487f51a542d51b2f1a48
The code was able to compile without errors or warnings.
Signed-off-by: David Hunter <david.hunter.linux@...il.com>
---
drivers/clk/clk-qoriq.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 4dcde305944c..941a0372db4b 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -1065,11 +1065,8 @@ static void __init _clockgen_init(struct device_node *np, bool legacy);
static void __init legacy_init_clockgen(struct device_node *np)
{
if (!clockgen.node) {
- struct device_node *parent_np;
-
- parent_np = of_get_parent(np);
+ struct device_node __free(device_node) *parent_np = of_get_parent(np);
_clockgen_init(parent_np, true);
- of_node_put(parent_np);
}
}
--
2.43.0
Powered by blists - more mailing lists