From: Xiaxi Shen <shenxiaxi26@gmail.com>
To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de
Cc: hpa@zytor.com, shenxiaxi26@gmail.com,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
javier.carrasco.cruz@gmail.com, julia.lawall@inria.fr
Subject: [PATCH] Replace of_node_put() with new cleanup feature
Date: Tue, 23 Apr 2024 14:40:06 -0700 [thread overview]
Message-ID: <20240423214006.29030-1-shenxiaxi26@gmail.com> (raw)
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
reply other threads:[~2024-04-23 21:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240423214006.29030-1-shenxiaxi26@gmail.com \
--to=shenxiaxi26@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®