Skip to content

Commit a70cd9c

Browse files
committed
thunderbolt: Rework tb_tunnel_consumed_bandwidth()
Rework to avoid the goto as it only makes it confusing. Move logging to happen at the end so we can see all the tunnels this is being called. Signed-off-by: Mika Westerberg <[email protected]>
1 parent 5ae3677 commit a70cd9c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/thunderbolt/tunnel.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,26 +2361,20 @@ int tb_tunnel_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up,
23612361
{
23622362
int up_bw = 0, down_bw = 0;
23632363

2364-
if (!tb_tunnel_is_active(tunnel))
2365-
goto out;
2366-
2367-
if (tunnel->consumed_bandwidth) {
2364+
if (tb_tunnel_is_active(tunnel) && tunnel->consumed_bandwidth) {
23682365
int ret;
23692366

23702367
ret = tunnel->consumed_bandwidth(tunnel, &up_bw, &down_bw);
23712368
if (ret)
23722369
return ret;
2373-
2374-
tb_tunnel_dbg(tunnel, "consumed bandwidth %d/%d Mb/s\n", up_bw,
2375-
down_bw);
23762370
}
23772371

2378-
out:
23792372
if (consumed_up)
23802373
*consumed_up = up_bw;
23812374
if (consumed_down)
23822375
*consumed_down = down_bw;
23832376

2377+
tb_tunnel_dbg(tunnel, "consumed bandwidth %d/%d Mb/s\n", up_bw, down_bw);
23842378
return 0;
23852379
}
23862380

0 commit comments

Comments
 (0)