public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] da8xx-cfgchip.c: replace of_node_put with __free improves cleanup
@ 2024-07-20 15:24 David Hunter
  2024-07-20 16:18 ` David Lechner
  2024-07-29 23:19 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: David Hunter @ 2024-07-20 15:24 UTC (permalink / raw)
  To: david, mturquette, sboyd, linux-clk, linux-kernel
  Cc: David Hunter, julia.lawall, skhan, javier.carrasco.cruz

The use of the __free function allows the cleanup to be based on scope
instead of on another function called later. This makes the cleanup
automatic and less susceptible to errors later.

This code was compiled without errors or warnings.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
 drivers/clk/davinci/da8xx-cfgchip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c b/drivers/clk/davinci/da8xx-cfgchip.c
index ad2d0df43dc6..5ea0c072bfbe 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -749,11 +749,9 @@ static int da8xx_cfgchip_probe(struct platform_device *pdev)
 
 	clk_init = device_get_match_data(dev);
 	if (clk_init) {
-		struct device_node *parent;
+		struct device_node *parent __free(device_node) = of_get_parent(dev->of_node);
 
-		parent = of_get_parent(dev->of_node);
 		regmap = syscon_node_to_regmap(parent);
-		of_node_put(parent);
 	} else if (pdev->id_entry && pdata) {
 		clk_init = (void *)pdev->id_entry->driver_data;
 		regmap = pdata->cfgchip;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-29 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-20 15:24 [PATCH] da8xx-cfgchip.c: replace of_node_put with __free improves cleanup David Hunter
2024-07-20 16:18 ` David Lechner
2024-07-29 23:19 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox