Skip to contentSkip to conversation

drivers: w1: Add missing of_node_put() in w1.c

PATCH Applied Liang He 2 participants 2 messages Jun 15, 2022 – May 8, 2023

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 drivers: w1: Add missing of_node_put() in w1.c

In __w1_attach_slave_device, we really need not to use of_node_put in normal path as the reference is escaped by sl. However, we need of_node_put in the fail path before put_device.

---
 drivers/w1/w1.c | 1 +
 1 file changed, 1 insertion(+)
drivers/w1/w1.c +1 -0
index f2ae2e563dc5..44a0587105a8 100644
@@ -702,6 +702,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
 		dev_err(&sl->dev,
 			"Device registration [%s] failed. err=%d\n",
 			dev_name(&sl->dev), err);
+		of_node_put(sl->dev.of_node);			
 		put_device(&sl->dev);
 		return err;
 	}
Signature · 1 line
2.25.1