usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe()
PATCH 1/1 usb: typec: tcpm: qcom: fix connector fwnode_handle leak in qcom_pmic_typec_port_probe()
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.
--- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c +1 -0
@@ -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))
Signature · 1 line
2.56.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 10 lines
In
qcom_pmic_typec_port_probe(),device_get_named_child_node(dev, "connector")acquires a reference to the connectorfwnode_handleto passto_of_node(connector)todevm_of_regulator_get_optional(), but never releases the reference.Call
fwnode_handle_put(connector)immediately afterdevm_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 <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 5 lines · Selby Mashiki
In
qcom_pmic_typec_port_probe(),device_get_named_child_node(dev, "connector")acquires a reference to the connectorfwnode_handleto passto_of_node(connector)todevm_of_regulator_get_optional(), but never releases the reference.
Quoted 9 lines
Call
fwnode_handle_put(connector)immediately afterdevm_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 <[email protected]>--- 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/[email protected]/
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
Quoted 12 lines
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c +1
-0@@ -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))