octeontx2-pf: mcs: Remove dead code and semi-colon from rsrc_name()
PATCH v2 1/1 octeontx2-pf: mcs: Remove dead code and semi-colon from rsrc_name()
Every case in the switch-block ends with return statement, and the
default: branch handles the cases where rsrc_type is invalid and returns "Unknown", this makes the return statement at the end of the function unreachable and redundant.
The semi-colon is not required after the switch-block's curly braces.
Remove the semi-colon after the switch-block's curly braces and the return statement at the end of the function.
This issue was reported by Coverity Scan.
Report:
CID 1516236: (#1 of 1): Structurally dead code (UNREACHABLE)
unreachable: This code cannot be reached: return "Unknown";.
---
v2:
- Changed the commit message to better explain why the code is not reachable.
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +1 -3
@@ -133,9 +133,7 @@ static const char *rsrc_name(enum mcs_rsrc_type rsrc_type)return "SA" ;default :return "Unknown" ; - }; - -return "Unknown" ; + } } static int cn10k_mcs_alloc_rsrc(struct otx2_nic *pfvf, enum mcs_direction dir,
Signature · 1 line
2.34.1
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sat, 4 Jan 2025 22:49:15 +0530 you wrote:
Every case in the switch-block ends with return statement, and the
default: branch handles the cases wherersrc_typeis invalid and returns "Unknown", this makes the return statement at the end of the function unreachable and redundant.
The semi-colon is not required after the switch-block's curly braces.Remove the semi-colon after the switch-block's curly braces and the return statement at the end of the function.
[...]
Here is the summary with links:
- [v2] octeontx2-pf: mcs: Remove dead code and semi-colon from rsrc_name()
https://git.kernel.org/netdev/net-next/c/49afc040f4d7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html