From: Miguel Miranda <mmikernel@gmail.com>
To: thierry.reding@gmail.com, jonathanh@nvidia.com,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com,
julia.lawall@inria.fr
Subject: [PATCH] drivers/soc/tegra: Replace dev_node refcount management
Date: Tue, 23 Apr 2024 19:53:06 -0600 [thread overview]
Message-ID: <20240424015306.1796838-1-mmikernel@gmail.com> (raw)
Remove the manual refcount management of device_node
and instead, use scope-based resource management.
While the pointer never gets out of scope it reduces
somehow the risk of missing the of_node_put() call.
Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Miguel Miranda <mmikernel@gmail.com>
---
I only have a deprecated jetson nano dev-kit, but need
to test this on hardware. I am exploring options to
build a rootfs to test this using qemu-system-aarch64.
---
drivers/soc/tegra/common.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
index dff6d5ef4e46..94d11102d90f 100644
--- a/drivers/soc/tegra/common.c
+++ b/drivers/soc/tegra/common.c
@@ -28,14 +28,12 @@ static const struct of_device_id tegra_machine_match[] = {
bool soc_is_tegra(void)
{
const struct of_device_id *match;
- struct device_node *root;
+ struct device_node *root __free(device_node) = of_find_node_by_path("/");
- root = of_find_node_by_path("/");
if (!root)
return false;
match = of_match_node(tegra_machine_match, root);
- of_node_put(root);
return match != NULL;
}
--
2.25.1
next reply other threads:[~2024-04-24 1:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 1:53 Miguel Miranda [this message]
2024-04-25 15:35 ` [PATCH] drivers/soc/tegra: Replace dev_node refcount management Thierry Reding
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=20240424015306.1796838-1-mmikernel@gmail.com \
--to=mmikernel@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=thierry.reding@gmail.com \
/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