hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/usb/typec/tcpm/tcpci.c
....@@ -642,6 +642,10 @@
642642 if (time_after(jiffies, timeout))
643643 return -ETIMEDOUT;
644644
645
+ ret = tcpci_write16(tcpci, TCPC_FAULT_STATUS, TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT);
646
+ if (ret < 0)
647
+ return ret;
648
+
645649 /* Handle vendor init */
646650 if (tcpci->data->init) {
647651 ret = tcpci->data->init(tcpci, tcpci->data);
....@@ -844,8 +848,10 @@
844848 return ERR_PTR(err);
845849
846850 tcpci->port = tcpm_register_port(tcpci->dev, &tcpci->tcpc);
847
- if (IS_ERR(tcpci->port))
851
+ if (IS_ERR(tcpci->port)) {
852
+ fwnode_handle_put(tcpci->tcpc.fwnode);
848853 return ERR_CAST(tcpci->port);
854
+ }
849855
850856 return tcpci;
851857 }
....@@ -854,6 +860,7 @@
854860 void tcpci_unregister_port(struct tcpci *tcpci)
855861 {
856862 tcpm_unregister_port(tcpci->port);
863
+ fwnode_handle_put(tcpci->tcpc.fwnode);
857864 }
858865 EXPORT_SYMBOL_GPL(tcpci_unregister_port);
859866