mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Replace of_node_put() with new cleanup feature
@ 2024-04-23 21:40 Xiaxi Shen
  0 siblings, 0 replies; only message in thread
From: Xiaxi Shen @ 2024-04-23 21:40 UTC (permalink / raw)
  To: tglx, mingo, bp
  Cc: hpa, shenxiaxi26, linux-kernel, skhan, javier.carrasco.cruz,
	julia.lawall

Use the new cleanup magic to replace of_node_put() with
__free(device_node) marking to auto release and to simplify the error
paths

Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Xiaxi Shen <shenxiaxi26@gmail.com>
---
 arch/x86/platform/olpc/olpc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 1d4a00e767ec..66c4d1f888e7 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -202,7 +202,7 @@ static u32 __init get_board_revision(struct device_node *root)
 
 static bool __init platform_detect(void)
 {
-	struct device_node *root = of_find_node_by_path("/");
+	struct device_node *root __free(device_node) = of_find_node_by_path("/");
 	bool success;
 
 	if (!root)
@@ -218,7 +218,6 @@ static bool __init platform_detect(void)
 			olpc_platform_info.boardrev >> 4);
 	}
 
-	of_node_put(root);
 	return success;
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-23 21:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 21:40 [PATCH] Replace of_node_put() with new cleanup feature Xiaxi Shen

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

all inboxes | Powered by JetHome®