Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <bjorn.andersson@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250708085717.15922-1-johan@kernel.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Johan Hovold and committed by
Bjorn Andersson
65702c3d 50b749fa

+7 -2
+7 -2
drivers/soc/qcom/pmic_glink.c
··· 167 167 return 0; 168 168 } 169 169 170 - static void pmic_glink_aux_release(struct device *dev) {} 170 + static void pmic_glink_aux_release(struct device *dev) 171 + { 172 + of_node_put(dev->of_node); 173 + } 171 174 172 175 static int pmic_glink_add_aux_device(struct pmic_glink *pg, 173 176 struct auxiliary_device *aux, ··· 184 181 aux->dev.release = pmic_glink_aux_release; 185 182 device_set_of_node_from_dev(&aux->dev, parent); 186 183 ret = auxiliary_device_init(aux); 187 - if (ret) 184 + if (ret) { 185 + of_node_put(aux->dev.of_node); 188 186 return ret; 187 + } 189 188 190 189 ret = auxiliary_device_add(aux); 191 190 if (ret)