summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/tcpm/tcpm.c
diff options
context:
space:
mode:
authorJun Li2019-01-22 10:00:24 +0100
committerGreg Kroah-Hartman2019-01-25 10:02:50 +0100
commit9997ab35f4284ea5bd07768797929d1d646064c8 (patch)
treee3e369629ee89f184b5b23afb2ad6dc0423a3ccb /drivers/usb/typec/tcpm/tcpm.c
parentusb: misc: usb3503: Add system sleep support in non-I2C mode (diff)
downloadkernel-qcow2-linux-9997ab35f4284ea5bd07768797929d1d646064c8.tar.gz
kernel-qcow2-linux-9997ab35f4284ea5bd07768797929d1d646064c8.tar.xz
kernel-qcow2-linux-9997ab35f4284ea5bd07768797929d1d646064c8.zip
usb: typec: tpcm: improve error handling of tcpm_register_port
Remove debugfs if tcpm register port fails. Signed-off-by: Li Jun <jun.li@nxp.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/tcpm/tcpm.c')
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 4bc29b586698..f1d3e54210df 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4810,12 +4810,12 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
err = devm_tcpm_psy_register(port);
if (err)
- goto out_destroy_wq;
+ goto out_role_sw_put;
port->typec_port = typec_register_port(port->dev, &port->typec_caps);
if (IS_ERR(port->typec_port)) {
err = PTR_ERR(port->typec_port);
- goto out_destroy_wq;
+ goto out_role_sw_put;
}
if (tcpc->config && tcpc->config->alt_modes) {
@@ -4848,8 +4848,10 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
tcpm_log(port, "%s: registered", dev_name(dev));
return port;
-out_destroy_wq:
+out_role_sw_put:
usb_role_switch_put(port->role_sw);
+out_destroy_wq:
+ tcpm_debugfs_exit(port);
destroy_workqueue(port->wq);
return ERR_PTR(err);
}