]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit98cda6e005da9abfa98264fdc7b81dcd578d1f5e
tree00170eac21c7f81dcc9e5e82cf580e41c3bde1d5
parent3b9fe42b02d9b212a84ce5eeb70f4e7e9ce94352
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