summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuho Choi <dbgh9129@gmail.com>2026-08-01 19:50:08 -0400
committerThierry Reding <treding@nvidia.com>2026-10-03 00:47:52 +0200
commit4eaed7ea6ab36e1160d660b05551702c36dfed6c (patch)
treea4b87231442d0117da2b05c8930bff03eb82b8bb
parentc842922f5ff229c9df2a2be56327c36aced7a3a7 (diff)
soc/tegra: flowctrl: Release OF node reference on error
tegra_flowctrl_init() obtains a reference from of_find_matching_node() and currently releases it only after of_address_to_resource() succeeds. Release the reference before checking the resource conversion result so the error path is balanced as well. Fixes: 1fd09e5d884a ("soc/tegra: Add initial flowctrl support for Tegra132/210") Signed-off-by: Yuho Choi <dbgh9129@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/soc/tegra/flowctrl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/soc/tegra/flowctrl.c b/drivers/soc/tegra/flowctrl.c
index 221202db3313..d5c3af586d31 100644
--- a/drivers/soc/tegra/flowctrl.c
+++ b/drivers/soc/tegra/flowctrl.c
@@ -195,11 +195,14 @@ static int __init tegra_flowctrl_init(void)
np = of_find_matching_node(NULL, tegra_flowctrl_match);
if (np) {
- if (of_address_to_resource(np, 0, &res) < 0) {
+ int err = of_address_to_resource(np, 0, &res);
+
+ of_node_put(np);
+
+ if (err < 0) {
pr_err("failed to get flowctrl register\n");
return -ENXIO;
}
- of_node_put(np);
} else if (IS_ENABLED(CONFIG_ARM)) {
/*
* Hardcoded fallback for 32-bit Tegra