linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible cut'n'paste error in linux-6.5/drivers/thunderbolt/tmu.c
@ 2023-08-31 11:02 David Binderman
  2023-08-31 11:16 ` mika.westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2023-08-31 11:02 UTC (permalink / raw)
  To: andreas.noever@gmail.com, michael.jamet@intel.com,
	mika.westerberg@linux.intel.com, YehezkelShB@gmail.com,
	linux-usb@vger.kernel.org, Linux Kernel Mailing List

Hello there,

I just tried out static analyser cppcheck on linux-6.5. It said:

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

Source code is

            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)
                sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;

Regards

David Binderman

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

* Re: Possible cut'n'paste error in linux-6.5/drivers/thunderbolt/tmu.c
  2023-08-31 11:02 Possible cut'n'paste error in linux-6.5/drivers/thunderbolt/tmu.c David Binderman
@ 2023-08-31 11:16 ` mika.westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: mika.westerberg @ 2023-08-31 11:16 UTC (permalink / raw)
  To: David Binderman
  Cc: andreas.noever@gmail.com, michael.jamet@intel.com,
	YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
	Linux Kernel Mailing List

Hi,

On Thu, Aug 31, 2023 at 11:02:58AM +0000, David Binderman wrote:
> Hello there,
> 
> I just tried out static analyser cppcheck on linux-6.5. It said:
> 
> linux-6.5/drivers/thunderbolt/tmu.c:385:50: style: Expression is always false because 'else if' condition matches previous condition at line 383. [multiCondition]
> 
> Source code is
> 
>             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)
>                 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;
> 

Thanks for the report. Indeed, this should be

             else if (tmu_rates[TB_SWITCH_TMU_MODE_HIFI_UNI] == rate)
                 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;

I will fix it up and send out after v6.6-rc1 is released.

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

end of thread, other threads:[~2023-08-31 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 11:02 Possible cut'n'paste error in linux-6.5/drivers/thunderbolt/tmu.c David Binderman
2023-08-31 11:16 ` mika.westerberg

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