From: Guenter Roeck <linux@roeck-us.net>
To: Jun Li <jun.li@nxp.com>
Cc: "heikki.krogerus@linux.intel.com"
<heikki.krogerus@linux.intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: usb: typec: tpcm: improve error handling of tcpm_register_port
Date: Tue, 22 Jan 2019 07:36:54 -0800 [thread overview]
Message-ID: <20190122153654.GA1705@roeck-us.net> (raw)
On Tue, Jan 22, 2019 at 09:00:24AM +0000, Jun Li wrote:
> Remove debugfs if tcpm register port fails.
>
> Signed-off-by: Li Jun <jun.li@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4f1f421..4cdc53d 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4787,12 +4787,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) {
> @@ -4825,8 +4825,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);
> }
> --
> 2.7.4
>
next reply other threads:[~2019-01-22 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 15:36 Guenter Roeck [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-01-22 13:27 usb: typec: tpcm: improve error handling of tcpm_register_port Heikki Krogerus
2019-01-22 9:00 Jun Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190122153654.GA1705@roeck-us.net \
--to=linux@roeck-us.net \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jun.li@nxp.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).