* [PATCH] usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe()
@ 2026-10-25 20:31 Selby Mashiki
2026-10-25 22:00 ` David Heidelberg
0 siblings, 1 reply; 2+ messages in thread
From: Selby Mashiki @ 2026-10-25 20:31 UTC (permalink / raw)
To: Bryan O'Donoghue, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-arm-msm, linux-usb, linux-kernel, Selby Mashiki
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@gmail.com>
---
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 +
1 file changed, 1 insertion(+)
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))
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe()
2026-10-25 20:31 [PATCH] usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe() Selby Mashiki
@ 2026-10-25 22:00 ` David Heidelberg
0 siblings, 0 replies; 2+ messages in thread
From: David Heidelberg @ 2026-10-25 22:00 UTC (permalink / raw)
To: Selby Mashiki, Bryan O'Donoghue, Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-arm-msm, linux-usb, linux-kernel
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@gmail.com>
> ---
> 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@ixit.cz/
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))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-25 22:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 20:31 [PATCH] usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe() Selby Mashiki
2026-10-25 22:00 ` David Heidelberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®