[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240424015306.1796838-1-mmikernel@gmail.com>
Date: Tue, 23 Apr 2024 19:53:06 -0600
From: Miguel Miranda <mmikernel@...il.com>
To: thierry.reding@...il.com,
jonathanh@...dia.com,
linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: skhan@...uxfoundation.org,
javier.carrasco.cruz@...il.com,
julia.lawall@...ia.fr
Subject: [PATCH] drivers/soc/tegra: Replace dev_node refcount management
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@...ia.fr>
Signed-off-by: Miguel Miranda <mmikernel@...il.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
Powered by blists - more mailing lists