@@ -258,15 +258,22 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port,
tcpm->tcpm_port);
if (ret)
- goto fwnode_remove;
+ goto tcpm_unregister_port;
ret = qcom_pmic_typec_pdphy_start(tcpm->pmic_typec_pdphy,
tcpm->tcpm_port);
if (ret)
- goto fwnode_remove;
+ goto typec_stop;
return 0;
+
+typec_stop:
+ qcom_pmic_typec_port_stop(tcpm->pmic_typec_port);
+
+tcpm_unregister_port:
+ tcpm_unregister_port(tcpm->tcpm_port);
+
fwnode_remove:
fwnode_remove_software_node(tcpm->tcpc.fwnode);
Implement proper error path in the qcom_pmic_typec_probe(). This makes sure that we properly disable hardware blocks and do not leak memory. Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)