lkml.org 
[lkml]   [2022]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: linux-5.17-rc5/arch/mips/cavium-octeon/executive/octeon-model.c bug report
On Tue, Feb 22, 2022 at 05:00:26PM +0000, David Binderman wrote:
> I just ran static analyser cppcheck over the linux kernel 5.17-rc5. It said:
>
> linux-5.17-rc5/arch/mips/cavium-octeon/executive/octeon-model.c:359:11: style: Variable 'suffix' is reassigned a value before the old one has been used. [redundantAssignment]
>
> Source code is
>
> if (fus_dat2.cn66xx.nocrypto && fus_dat2.cn66xx.dorm_crypto)
> suffix = "AP";
> if (fus_dat2.cn66xx.nocrypto)
> suffix = "CP";
>
> Maybe better code:
>
> if (fus_dat2.cn66xx.nocrypto && fus_dat2.cn66xx.dorm_crypto)
> suffix = "AP";
> else if (fus_dat2.cn66xx.nocrypto)
> suffix = "CP";

IMHO this isn't better just different. As I don't have any Cavium docs
about their SoCs, it's hard to say what's the correct way to fix this.
There is the same pattern in CN61XX case

if (fus_dat2.cn61xx.nocrypto && fus_dat2.cn61xx.dorm_crypto)
suffix = "AP";
if (fus_dat2.cn61xx.nocrypto)
suffix = "CP";

which isn't present in the latest Cavium SDK. So maybe just removing

if (fus_dat2.cn66xx.nocrypto && fus_dat2.cn66xx.dorm_crypto)
suffix = "AP";

is more appropriate.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

\
 
 \ /
  Last update: 2022-02-22 22:46    [W:0.020 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site