Re: [PATCH] thermal/drivers/airoha: Fix a device node reference leak in airoha_thermal_probe()

From: Lukasz Luba

Date: Wed Jan 28 2026 - 12:22:50 EST


Hi Felix,

On 1/23/26 11:55, Felix Gu wrote:
In airoha_thermal_probe() function, chip-scu node is acquired through
of_parse_phandle(), but it fails to release this reference if
syscon_node_to_regmap() returns an error.
Add the missing of_node_put() call to the error path to ensure the
reference count is properly decremented.

Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor")
Signed-off-by: Felix Gu <ustc.gu@xxxxxxxxx>
---
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 b9fd6bfc88e5..308ea846ba26 100644
--- a/drivers/thermal/airoha_thermal.c
+++ b/drivers/thermal/airoha_thermal.c
@@ -431,8 +431,10 @@ static int airoha_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);
+ }
of_address_to_resource(chip_scu_np, 0, &priv->scu_adc_res);
of_node_put(chip_scu_np);

Thank you for the patch, LGTM.

Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>