Re: [PATCH] usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe()

From: David Heidelberg

Date: Sun Oct 25 2026 - 18:00:55 EST


On 25/10/2026 21:31, Selby Mashiki wrote:
In qcom_pmic_typec_port_probe(), device_get_named_child_node(dev,
"connector") acquires a reference to the connector fwnode_handle to pass
to_of_node(connector) to devm_of_regulator_get_optional(), but never
releases the reference.

Call fwnode_handle_put(connector) immediately after
devm_of_regulator_get_optional() to fix the leak.

Fixes: 506927b6bf29 ("usb: typec: tcpm: qcom: prefer VBUS supply from the connector node")
Signed-off-by: Selby Mashiki <mashikiselby@xxxxxxxxx>
---
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 +
1 file changed, 1 insertion(+)


Hello Selby,

check out

https://lore.kernel.org/linux-arm-msm/20261025-typec-of-fix-v1-1-06bfc16a7846@xxxxxxx/

This is one of the patches from the gen1 Type-C enablement series and it seems to be almost same as yours, if it looks good to you, feel free to drop A-b/R-b.

Thanks
David

diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
index bf985efe1..b89495315 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
@@ -728,6 +728,7 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
pmic_typec_port->vdd_vbus = devm_of_regulator_get_optional(dev,
to_of_node(connector),
"vbus");
+ fwnode_handle_put(connector);
if (pmic_typec_port->vdd_vbus == ERR_PTR(-ENODEV))
pmic_typec_port->vdd_vbus = devm_regulator_get(dev, "vdd-vbus");
if (IS_ERR(pmic_typec_port->vdd_vbus))