Skip to content

Commit b8423a2

Browse files
javiercarrascocruzgregkh
authored andcommitted
usb: typec: qcom-pmic-typec: fix missing fwnode removal in error path
If drm_dp_hpd_bridge_register() fails, the probe function returns without removing the fwnode via fwnode_handle_put(), leaking the resource. Jump to fwnode_remove if drm_dp_hpd_bridge_register() fails to remove the fwnode acquired with device_get_named_child_node(). Cc: [email protected] Fixes: 7d9f1b7 ("usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE") Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Acked-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/20241020-qcom_pmic_typec-fwnode_remove-v2-2-7054f3d2e215@gmail.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7f02b8a commit b8423a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
9393
return -EINVAL;
9494

9595
bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode));
96-
if (IS_ERR(bridge_dev))
97-
return PTR_ERR(bridge_dev);
96+
if (IS_ERR(bridge_dev)) {
97+
ret = PTR_ERR(bridge_dev);
98+
goto fwnode_remove;
99+
}
98100

99101
tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
100102
if (IS_ERR(tcpm->tcpm_port)) {

0 commit comments

Comments
 (0)