From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: David Binderman <dcb314@hotmail.com>
Cc: "linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-5.17-rc5/arch/mips/cavium-octeon/executive/octeon-model.c bug report
Date: Tue, 22 Feb 2022 22:44:55 +0100 [thread overview]
Message-ID: <20220222214455.GB18724@alpha.franken.de> (raw)
In-Reply-To: <VI1P189MB0573726CE8E7812C1D91A9519C3B9@VI1P189MB0573.EURP189.PROD.OUTLOOK.COM>
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 ]
parent reply other threads:[~2022-02-22 21:45 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <VI1P189MB0573726CE8E7812C1D91A9519C3B9@VI1P189MB0573.EURP189.PROD.OUTLOOK.COM>]
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=20220222214455.GB18724@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=dcb314@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
/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
all inboxes | Powered by JetHome®