linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xhci: Remove unnecessary condition from xhci_check_tt_bw_table
@ 2021-05-24 16:01 Alexandr Ivanov
  0 siblings, 0 replies; only message in thread
From: Alexandr Ivanov @ 2021-05-24 16:01 UTC (permalink / raw)
  To: mathias.nyman; +Cc: gregkh, linux-usb, Alexandr Ivanov

Remove condition (old_active_eps == 0) from xhci_check_tt_bw_table
because the previous check of old_active_eps returns
from the function if old_active_eps is not zero.

Move the previous condition to the function beginning.

Signed-off-by: Alexandr Ivanov <alexandr.sky@gmail.com>
---
 drivers/usb/host/xhci.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 27283654ca08..14aae87d6c8f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2329,16 +2329,18 @@ static int xhci_check_tt_bw_table(struct xhci_hcd *xhci,
 	struct xhci_interval_bw_table *bw_table;
 	struct xhci_tt_bw_info *tt_info;
 
-	/* Find the bandwidth table for the root port this TT is attached to. */
-	bw_table = &xhci->rh_bw[virt_dev->real_port - 1].bw_table;
-	tt_info = virt_dev->tt_info;
 	/* If this TT already had active endpoints, the bandwidth for this TT
 	 * has already been added.  Removing all periodic endpoints (and thus
 	 * making the TT enactive) will only decrease the bandwidth used.
 	 */
 	if (old_active_eps)
 		return 0;
-	if (old_active_eps == 0 && tt_info->active_eps != 0) {
+
+	/* Find the bandwidth table for the root port this TT is attached to. */
+	bw_table = &xhci->rh_bw[virt_dev->real_port - 1].bw_table;
+	tt_info = virt_dev->tt_info;
+
+	if (tt_info->active_eps != 0) {
 		if (bw_table->bw_used + TT_HS_OVERHEAD > HS_BW_LIMIT)
 			return -ENOMEM;
 		return 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-24 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 16:01 [PATCH v2] xhci: Remove unnecessary condition from xhci_check_tt_bw_table Alexandr Ivanov

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