Commit 09073525 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by David S. Miller

net: ethernet: sun: Zero initialize class in default case in niu_add_ethtool_tcam_entry

When building with -Wsometimes-uninitialized, Clang warns:

drivers/net/ethernet/sun/niu.c:7466:5: warning: variable 'class' is used
uninitialized whenever switch default is taken
[-Wsometimes-uninitialized]

The default case can never happen because i can only be 0 to 3
(NIU_L3_PROG_CLS is defined as 4). To make this clear to Clang,
just zero initialize class in the default case (use the macro
CLASS_CODE_UNRECOG to make it clear this shouldn't happen).

Link: https://github.com/ClangBuiltLinux/linux/issues/403Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 580411d0
...@@ -7464,6 +7464,7 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, ...@@ -7464,6 +7464,7 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
class = CLASS_CODE_USER_PROG4; class = CLASS_CODE_USER_PROG4;
break; break;
default: default:
class = CLASS_CODE_UNRECOG;
break; break;
} }
ret = tcam_user_ip_class_set(np, class, 0, ret = tcam_user_ip_class_set(np, class, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment