public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Make tb_tunnel_alloc_usb3() error paths consistent with the rest
@ 2025-02-13 14:16 Mika Westerberg
  2025-02-24  7:37 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Mika Westerberg @ 2025-02-13 14:16 UTC (permalink / raw)
  To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
  Cc: Alan Borzeszkowski, linux-usb, Mika Westerberg

From: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>

Make the tb_tunnel_alloc_usb3() error codepaths consistent with the
DisplayPort and PCIe counterparts.

No functional changes.

Signed-off-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/tunnel.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 8229a6fbda5a..072f7e80263e 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -2224,19 +2224,15 @@ struct tb_tunnel *tb_tunnel_alloc_usb3(struct tb *tb, struct tb_port *up,
 
 	path = tb_path_alloc(tb, down, TB_USB3_HOPID, up, TB_USB3_HOPID, 0,
 			     "USB3 Down");
-	if (!path) {
-		tb_tunnel_put(tunnel);
-		return NULL;
-	}
+	if (!path)
+		goto err_free;
 	tb_usb3_init_path(path);
 	tunnel->paths[TB_USB3_PATH_DOWN] = path;
 
 	path = tb_path_alloc(tb, up, TB_USB3_HOPID, down, TB_USB3_HOPID, 0,
 			     "USB3 Up");
-	if (!path) {
-		tb_tunnel_put(tunnel);
-		return NULL;
-	}
+	if (!path)
+		goto err_free;
 	tb_usb3_init_path(path);
 	tunnel->paths[TB_USB3_PATH_UP] = path;
 
@@ -2253,6 +2249,10 @@ struct tb_tunnel *tb_tunnel_alloc_usb3(struct tb *tb, struct tb_port *up,
 	}
 
 	return tunnel;
+
+err_free:
+	tb_tunnel_put(tunnel);
+	return NULL;
 }
 
 /**
-- 
2.47.2


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

* Re: [PATCH] thunderbolt: Make tb_tunnel_alloc_usb3() error paths consistent with the rest
  2025-02-13 14:16 [PATCH] thunderbolt: Make tb_tunnel_alloc_usb3() error paths consistent with the rest Mika Westerberg
@ 2025-02-24  7:37 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2025-02-24  7:37 UTC (permalink / raw)
  To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
  Cc: Alan Borzeszkowski, linux-usb

On Thu, Feb 13, 2025 at 04:16:30PM +0200, Mika Westerberg wrote:
> From: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
> 
> Make the tb_tunnel_alloc_usb3() error codepaths consistent with the
> DisplayPort and PCIe counterparts.
> 
> No functional changes.
> 
> Signed-off-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Applied to thunderbolt.git/next.

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

end of thread, other threads:[~2025-02-24  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 14:16 [PATCH] thunderbolt: Make tb_tunnel_alloc_usb3() error paths consistent with the rest Mika Westerberg
2025-02-24  7:37 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox