tr...@redhat.com
unread,Sep 7, 2020, 11:32:35 AM9/7/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tony...@intel.com, qiuxu...@intel.com, b...@alien8.de, mch...@kernel.org, james...@arm.com, rr...@kernel.org, natecha...@gmail.com, ndesau...@google.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, clang-bu...@googlegroups.com, Tom Rix
From: Tom Rix <
tr...@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 <
tr...@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