Messages in this thread | | | Date | Tue, 22 Feb 2022 22:44:55 +0100 | From | Thomas Bogendoerfer <> | Subject | Re: 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 ]
| |