From: trix@redhat.com
To: tony.luck@intel.com, qiuxu.zhuo@intel.com, bp@alien8.de,
mchehab@kernel.org, james.morse@arm.com, rric@kernel.org,
natechancellor@gmail.com, ndesaulniers@google.com
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com, Tom Rix <trix@redhat.com>
Subject: [PATCH] EDAC: sb_edac: simplify switch statement
Date: Mon, 7 Sep 2020 08:32:25 -0700 [thread overview]
Message-ID: <20200907153225.7294-1-trix@redhat.com> (raw)
From: Tom Rix <trix@redhat.com>
clang static analyzer reports this problem
sb_edac.c:959:2: warning: Undefined or garbage value
returned to caller
return type;
^~~~~~~~~~~
This is a false positive.
However by initializing the type to DEV_UNKNOWN the 3 case can be
removed from the switch, saving a comparison and jump.
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/edac/sb_edac.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 68f2fe4df333..93daa4297f2e 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -939,12 +939,9 @@ static enum dev_type sbridge_get_width(struct sbridge_pvt *pvt, u32 mtr)
static enum dev_type __ibridge_get_width(u32 mtr)
{
- enum dev_type type;
+ enum dev_type type = DEV_UNKNOWN;
switch (mtr) {
- case 3:
- type = DEV_UNKNOWN;
- break;
case 2:
type = DEV_X16;
break;
--
2.18.1
next reply other threads:[~2020-09-07 15:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 15:32 trix [this message]
2020-09-08 4:28 ` [PATCH] EDAC: sb_edac: simplify switch statement Nathan Chancellor
2020-09-08 22:08 ` Luck, Tony
2020-09-10 16:11 ` Borislav Petkov
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=20200907153225.7294-1-trix@redhat.com \
--to=trix@redhat.com \
--cc=bp@alien8.de \
--cc=clang-built-linux@googlegroups.com \
--cc=james.morse@arm.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=qiuxu.zhuo@intel.com \
--cc=rric@kernel.org \
--cc=tony.luck@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).