All of lore.kernel.org
 help / color / mirror / Atom feed
* usb: typec: tpcm: improve error handling of tcpm_register_port
@ 2019-01-22 15:36 Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-01-22 15:36 UTC (permalink / raw)
  To: Jun Li; +Cc: heikki.krogerus, gregkh, linux-usb

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* usb: typec: tpcm: improve error handling of tcpm_register_port
@ 2019-01-22 13:27 Heikki Krogerus
  0 siblings, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2019-01-22 13:27 UTC (permalink / raw)
  To: Jun Li; +Cc: linux, gregkh, linux-usb

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: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  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

thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* usb: typec: tpcm: improve error handling of tcpm_register_port
@ 2019-01-22  9:00 Jun Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2019-01-22  9:00 UTC (permalink / raw)
  To: linux, heikki.krogerus; +Cc: gregkh, linux-usb

Remove debugfs if tcpm register port fails.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 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);
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-22 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 15:36 usb: typec: tpcm: improve error handling of tcpm_register_port Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2019-01-22 13:27 Heikki Krogerus
2019-01-22  9:00 Jun Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.