Skip to contentSkip to conversation

soc: qcom: pmic_glink: fix OF node leak

PATCH Applied Johan Hovold 3 participants 3 messages Jul 8, 2025 – Jul 17, 2025

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

PATCH 1/1 soc: qcom: pmic_glink: fix OF node leak

Make sure to drop the OF node reference taken when registering the auxiliary devices when the devices are later released.

Fixes 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
Cc Bjorn Andersson <[email protected]>
---
 drivers/soc/qcom/pmic_glink.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/soc/qcom/pmic_glink.c +7 -2
index 0a6d325b195c..c0a4be5df926 100644
@@ -167,7 +167,10 @@ static int pmic_glink_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
 	return 0;
 }
 
-static void pmic_glink_aux_release(struct device *dev) {}
+static void pmic_glink_aux_release(struct device *dev)
+{
+	of_node_put(dev->of_node);
+}
 
 static int pmic_glink_add_aux_device(struct pmic_glink *pg,
 				     struct auxiliary_device *aux,
@@ -181,8 +184,10 @@ static int pmic_glink_add_aux_device(struct pmic_glink *pg,
 	aux->dev.release = pmic_glink_aux_release;
 	device_set_of_node_from_dev(&aux->dev, parent);
 	ret = auxiliary_device_init(aux);
-	if (ret)
+	if (ret) {
+		of_node_put(aux->dev.of_node);
 		return ret;
+	}
 
 	ret = auxiliary_device_add(aux);
 	if (ret)
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Johan Hovold

Make sure to drop the OF node reference taken when registering the auxiliary devices when the devices are later released.

Fixes 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
Cc Bjorn Andersson <[email protected]>

---

Hmm.. maybe the auxdev APIs could one day do this internally

in any case

Konrad

maintainer Applied
#2 lore raw
In reply to Johan Hovold
Quoted 4 lines · Johan Hovold

Make sure to drop the OF node reference taken when registering the auxiliary devices when the devices are later released.

Applied, thanks!

[1/1] soc: qcom: pmic_glink: fix OF node leak

      commit: 65702c3d293e45d3cac5e4e175296a9c90404326

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>