[PATCH] thermal/drivers/airoha: Fix device_node leak in en7581_thermal_probe()
From: laixiangwu
Date: Fri Oct 30 2026 - 00:08:11 EST
en7581_thermal_probe() obtains the "airoha,chip-scu" device node with
of_parse_phandle(), which takes a reference on the node. If the
subsequent syscon_node_to_regmap() call fails, probe() returns the
error without dropping the reference, leaking the device node.
All the other paths in the function already release the node with
of_node_put(chip_scu_np). Do the same on the failing regmap lookup.
Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor")
Signed-off-by: laixiangwu <laixiangwu@xxxxxxxxxxxxxxxxxxxx>
---
drivers/thermal/airoha_thermal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c
index 7c63a1b44..b7062b35c 100644
--- a/drivers/thermal/airoha_thermal.c
+++ b/drivers/thermal/airoha_thermal.c
@@ -572,8 +572,10 @@ static int en7581_thermal_probe(struct platform_device *pdev,
return -EINVAL;
priv->chip_scu = syscon_node_to_regmap(chip_scu_np);
- if (IS_ERR(priv->chip_scu))
+ if (IS_ERR(priv->chip_scu)) {
+ of_node_put(chip_scu_np);
return PTR_ERR(priv->chip_scu);
+ }
for (i = 0; i < AIROHA_THERMAL_FIELD_MAX; i++) {
struct regmap_field *field;