Skip to contentSkip to conversation

hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API

PATCH Applied Mengda Chen 2 participants 2 messages Sep 16, 2022 – Sep 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API

From: Liang He <[email protected]>

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")
---
 drivers/hwmon/gsc-hwmon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hwmon/gsc-hwmon.c +1 -0
index d64be48f1ef6..b60ec95b5edb 100644
@@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct device *dev)
 	pdata->nchannels = nchannels;
 
 	/* fan controller base address */
+	of_node_get(dev->parent->of_node);
 	fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan");
 	if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) {
 		of_node_put(fan);
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Mengda Chen

From: Liang He <[email protected]>

In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument.

Fixes 3bce5377ef66 ("hwmon: Add Gateworks System Controller support")

Applied.

Thanks,
Guenter