Skip to content

Commit e19f714

Browse files
committed
thunderbolt: Correct TMU mode initialization from hardware
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: d49b4f0 ("thunderbolt: Add support for enhanced uni-directional TMU mode") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent a9fdf5f commit e19f714

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thunderbolt/tmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static int tmu_mode_init(struct tb_switch *sw)
382382
} else if (ucap && tb_port_tmu_is_unidirectional(up)) {
383383
if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
384384
sw->tmu.mode = TB_SWITCH_TMU_MODE_LOWRES;
385-
else if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
385+
else if (tmu_rates[TB_SWITCH_TMU_MODE_HIFI_UNI] == rate)
386386
sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;
387387
} else if (rate) {
388388
sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI;

0 commit comments

Comments
 (0)