.. | .. |
---|
642 | 642 | if (time_after(jiffies, timeout)) |
---|
643 | 643 | return -ETIMEDOUT; |
---|
644 | 644 | |
---|
| 645 | + ret = tcpci_write16(tcpci, TCPC_FAULT_STATUS, TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT); |
---|
| 646 | + if (ret < 0) |
---|
| 647 | + return ret; |
---|
| 648 | + |
---|
645 | 649 | /* Handle vendor init */ |
---|
646 | 650 | if (tcpci->data->init) { |
---|
647 | 651 | ret = tcpci->data->init(tcpci, tcpci->data); |
---|
.. | .. |
---|
844 | 848 | return ERR_PTR(err); |
---|
845 | 849 | |
---|
846 | 850 | 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); |
---|
848 | 853 | return ERR_CAST(tcpci->port); |
---|
| 854 | + } |
---|
849 | 855 | |
---|
850 | 856 | return tcpci; |
---|
851 | 857 | } |
---|
.. | .. |
---|
854 | 860 | void tcpci_unregister_port(struct tcpci *tcpci) |
---|
855 | 861 | { |
---|
856 | 862 | tcpm_unregister_port(tcpci->port); |
---|
| 863 | + fwnode_handle_put(tcpci->tcpc.fwnode); |
---|
857 | 864 | } |
---|
858 | 865 | EXPORT_SYMBOL_GPL(tcpci_unregister_port); |
---|
859 | 866 | |
---|