Skip to contentSkip to conversation

Replace of_node_put() with new cleanup feature

PATCH New Xiaxi Shen 1 participant 1 message Apr 23, 2024 x86

lore
Share & tools
lore

Xiaxi Shen

author
#0 lore raw

PATCH 1/1 Replace of_node_put() with new cleanup feature

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

---
 arch/x86/platform/olpc/olpc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/platform/olpc/olpc.c +1 -2
index 1d4a00e767ec..66c4d1f888e7 100644
@@ -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;
 }
 
Signature · 1 line
2.34.1