OSDN Git Service

net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe()
authorNathan Chancellor <nathan@kernel.org>
Fri, 6 Aug 2021 19:13:40 +0000 (12:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Aug 2021 08:45:46 +0000 (09:45 +0100)
commit4367355dd90942a71641c98c40c74589c9bddf90
tree00170eac21c7f81dcc9e5e82cf580e41c3bde1d5
parent709db03a8afaf5196b36e633fbaa68b42fba95d5
net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe()

When compiling with clang in certain configurations, an objtool warning
appears:

drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.o: warning: objtool:
ipq806x_gmac_probe() falls through to next function phy_modes()

This happens because the unreachable annotation in the third switch
statement is not eliminated. The compiler should know that the first
default case would prevent the second and third from being reached as
the comment notes but sanitizer options can make it harder for the
compiler to reason this out.

Help the compiler out by eliminating the unreachable() annotation and
unifying the default case error handling so that there is no objtool
warning, the meaning of the code stays the same, and there is less
duplication.

Reported-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c