Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: "Yehezkel Bernat" <YehezkelShB@gmail.com>,
	"Michael Jamet" <michael.jamet@intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Andreas Noever" <andreas.noever@gmail.com>,
	"Werner Sembach" <wse@tuxedocomputers.com>,
	"Konrad J Hambrick" <kjhambrick@gmail.com>,
	"Calvin Walton" <calvin.walton@kepstin.ca>,
	"Marek Šanta" <teslan223@gmail.com>,
	"David Binderman" <dcb314@hotmail.com>,
	"Alex Balcanquall" <alex@alexbal.com>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>
Subject: [PATCH 3/5] thunderbolt: Correct TMU mode initialization from hardware
Date: Mon, 11 Sep 2023 13:04:43 +0300	[thread overview]
Message-ID: <20230911100445.3612655-4-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20230911100445.3612655-1-mika.westerberg@linux.intel.com>

David reported that cppcheck found following possible copy & paste
error from tmu_mode_init():

  tmu.c:385:50: style: Expression is always false because 'else if' condition matches previous condition at line 383. [multiCondition]

And indeed this is a bug. Fix it to use correct index
(TB_SWITCH_TMU_MODE_HIFI_UNI).

Reported-by: David Binderman <dcb314@hotmail.com>
Fixes: d49b4f043d63 ("thunderbolt: Add support for enhanced uni-directional TMU mode")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c
index 747f88703d5c..11f2aec2a5d3 100644
--- a/drivers/thunderbolt/tmu.c
+++ b/drivers/thunderbolt/tmu.c
@@ -382,7 +382,7 @@ static int tmu_mode_init(struct tb_switch *sw)
 		} else if (ucap && tb_port_tmu_is_unidirectional(up)) {
 			if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
 				sw->tmu.mode = TB_SWITCH_TMU_MODE_LOWRES;
-			else if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
+			else if (tmu_rates[TB_SWITCH_TMU_MODE_HIFI_UNI] == rate)
 				sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;
 		} else if (rate) {
 			sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI;
-- 
2.40.1


  parent reply	other threads:[~2023-09-11 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 10:04 [PATCH 0/5] thunderbolt: Couple of fixes and improvements Mika Westerberg
2023-09-11 10:04 ` [PATCH 1/5] thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple Ridge Mika Westerberg
2023-09-11 10:04 ` [PATCH 2/5] thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding Mika Westerberg
2023-09-11 10:04 ` Mika Westerberg [this message]
2023-09-11 10:04 ` [PATCH 4/5] thunderbolt: Apply USB 3.x bandwidth quirk only in software connection manager Mika Westerberg
2023-09-11 10:04 ` [PATCH 5/5] thunderbolt: Restart XDomain discovery handshake after failure Mika Westerberg
2023-09-15 10:10 ` [PATCH 0/5] thunderbolt: Couple of fixes and improvements Mika Westerberg
     [not found]   ` <CANBHt+PT9S59C-4S4riUm03fs2RKGwfVKM6i20=YUN5_-FSnWg@mail.gmail.com>
2023-09-15 11:12     ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230911100445.3612655-4-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=alex@alexbal.com \
    --cc=andreas.noever@gmail.com \
    --cc=calvin.walton@kepstin.ca \
    --cc=dcb314@hotmail.com \
    --cc=kjhambrick@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=teslan223@gmail.com \
    --cc=wse@tuxedocomputers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox