[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241019-qcom_pmic_typec-fwnode_remove-v1-1-884968902979@gmail.com>
Date: Sat, 19 Oct 2024 23:10:51 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>
Subject: [PATCH] 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_remove_software_node(), leaking
the resource.
Jump to fwnode_remove if drm_dp_hpd_bridge_register() fails to remove
the software node acquired with device_get_named_child_node().
Cc: stable@...r.kernel.org
Fixes: 7d9f1b72b296 ("usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
index 2201eeae5a99..776fc7f93f37 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
@@ -93,8 +93,10 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
return -EINVAL;
bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode));
- if (IS_ERR(bridge_dev))
- return PTR_ERR(bridge_dev);
+ if (IS_ERR(bridge_dev)) {
+ ret = PTR_ERR(bridge_dev);
+ goto fwnode_remove;
+ }
tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc);
if (IS_ERR(tcpm->tcpm_port)) {
---
base-commit: f2493655d2d3d5c6958ed996b043c821c23ae8d3
change-id: 20241019-qcom_pmic_typec-fwnode_remove-00dc49054cf7
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@...il.com>
Powered by blists - more mailing lists