Skip to contentSkip to conversation

macintosh: Add missing of_node_get() in do_attach()

PATCH Applied Liang He 2 participants 2 messages Jun 22, 2022 – Sep 9, 2022 Linux for power macintosh

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 macintosh: Add missing of_node_get() in do_attach()

We need a of_node_get() for of_find_compatible_node() to keep refcount balance.

---
 drivers/macintosh/therm_windtunnel.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/macintosh/therm_windtunnel.c +2 -0
index 9226b74fa08f..bee0510ab1df 100644
@@ -317,6 +317,7 @@ static void do_attach(struct i2c_adapter *adapter)
 	if (x.running || strncmp(adapter->name, "uni-n", 5))
 		return;
 
+	of_node_get(adapter->dev.of_node);
 	np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,ds1775");
 	if (np) {
 		of_node_put(np);
@@ -325,6 +326,7 @@ static void do_attach(struct i2c_adapter *adapter)
 		i2c_new_scanned_device(adapter, &info, scan_ds1775, NULL);
 	}
 
+	of_node_get(adapter->dev.of_node);
 	np = of_find_compatible_node(adapter->dev.of_node, NULL, "MAC,adm1030");
 	if (np) {
 		of_node_put(np);
Signature · 1 line
2.25.1