Kernel-Janitors Archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: typec: fusb302: Use common error handling code in fusb302_probe()
@ 2024-03-01 16:23 Markus Elfring
  2024-03-12  9:18 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-03-01 16:23 UTC (permalink / raw
  To: linux-usb, kernel-janitors, Greg Kroah-Hartman,
	Günter Röck, Heikki Krogerus, Krzysztof Kozlowski,
	RD Babiera, Rob Herring, Uwe Kleine-König, Yu Zhe
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 1 Mar 2024 17:00:23 +0100

Add a label so that a bit of exception handling can be better reused
at the end of this function implementation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/usb/typec/tcpm/fusb302.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index ef18a448b740..e1e030da1dec 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -1741,10 +1741,9 @@ static int fusb302_probe(struct i2c_client *client)

 	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
 	if (IS_ERR(chip->tcpm_port)) {
-		fwnode_handle_put(chip->tcpc_dev.fwnode);
 		ret = dev_err_probe(dev, PTR_ERR(chip->tcpm_port),
 				    "cannot register tcpm port\n");
-		goto destroy_workqueue;
+		goto put_fwnode;
 	}

 	ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn,
@@ -1761,6 +1760,7 @@ static int fusb302_probe(struct i2c_client *client)

 tcpm_unregister_port:
 	tcpm_unregister_port(chip->tcpm_port);
+put_fwnode:
 	fwnode_handle_put(chip->tcpc_dev.fwnode);
 destroy_workqueue:
 	fusb302_debugfs_exit(chip);
--
2.44.0


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

* Re: [PATCH] usb: typec: fusb302: Use common error handling code in fusb302_probe()
  2024-03-01 16:23 [PATCH] usb: typec: fusb302: Use common error handling code in fusb302_probe() Markus Elfring
@ 2024-03-12  9:18 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2024-03-12  9:18 UTC (permalink / raw
  To: Markus Elfring
  Cc: linux-usb, kernel-janitors, Greg Kroah-Hartman,
	Günter Röck, Krzysztof Kozlowski, RD Babiera,
	Rob Herring, Uwe Kleine-König, Yu Zhe, LKML

On Fri, Mar 01, 2024 at 05:23:25PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Mar 2024 17:00:23 +0100
> 
> Add a label so that a bit of exception handling can be better reused
> at the end of this function implementation.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/fusb302.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index ef18a448b740..e1e030da1dec 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -1741,10 +1741,9 @@ static int fusb302_probe(struct i2c_client *client)
> 
>  	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
>  	if (IS_ERR(chip->tcpm_port)) {
> -		fwnode_handle_put(chip->tcpc_dev.fwnode);
>  		ret = dev_err_probe(dev, PTR_ERR(chip->tcpm_port),
>  				    "cannot register tcpm port\n");
> -		goto destroy_workqueue;
> +		goto put_fwnode;
>  	}
> 
>  	ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn,
> @@ -1761,6 +1760,7 @@ static int fusb302_probe(struct i2c_client *client)
> 
>  tcpm_unregister_port:
>  	tcpm_unregister_port(chip->tcpm_port);
> +put_fwnode:
>  	fwnode_handle_put(chip->tcpc_dev.fwnode);
>  destroy_workqueue:
>  	fusb302_debugfs_exit(chip);
> --
> 2.44.0

-- 
heikki

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

end of thread, other threads:[~2024-03-12  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 16:23 [PATCH] usb: typec: fusb302: Use common error handling code in fusb302_probe() Markus Elfring
2024-03-12  9:18 ` Heikki Krogerus

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 read-only IMAP folder(s) and NNTP newsgroup(s).