net: mana: remove unreachable dead code in mana_bpf()
Subsystems (5)
PATCH 1/1 net: mana: remove unreachable dead code in mana_bpf()
mana_bpf() declares an uninitialized 'ret' and falls through to a trailing 'return ret;' after a switch statement whose every case (XDP_SETUP_PROG and default) already returns unconditionally. This statement is therefore unreachable dead code left over from an earlier refactor, and it would return an uninitialized value if it were ever reached.
Drop the unused variable and the unreachable return.
--- drivers/net/ethernet/microsoft/mana/mana_bpf.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_bpf.c +0 -3
@@ -253,7 +253,6 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog,int mana_bpf (struct net_device *ndev,struct netdev_bpf *bpf) {struct netlink_ext_ack *extack = bpf->extack; -int ret;switch (bpf->command) {case XDP_SETUP_PROG :
@@ -262,6 +261,4 @@ int mana_bpf(struct net_device *ndev, struct netdev_bpf *bpf)default :return -EOPNOTSUPP ; } - -return ret; }
Signature · 1 line
2.55.0
Quoted 10 lines · Muhammad Falak R Wani
mana_bpf()declares an uninitialized 'ret' and falls through to a trailing 'return ret;' after a switch statement whose every case (XDP_SETUP_PROGand default) already returns unconditionally. This statement is therefore unreachable dead code left over from an earlier refactor, and it would return an uninitialized value if it were ever reached.Drop the unused variable and the unreachable return.
Signed-off-by Muhammad Falak R Wani <[email protected]>
Quoted 26 lines
--- drivers/net/ethernet/microsoft/mana/mana_bpf.c | 3 --- 1 file changed, 3 deletions(-)drivers/net/ethernet/microsoft/mana/mana_bpf.c +0
-3@@ -253,7 +253,6 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog,int mana_bpf (struct net_device *ndev,struct netdev_bpf *bpf) {struct netlink_ext_ack *extack = bpf->extack; -int ret;switch (bpf->command) {case XDP_SETUP_PROG :@@ -262,6 +261,4 @@ int mana_bpf(struct net_device *ndev, struct netdev_bpf *bpf)default :return -EOPNOTSUPP ; } - -return ret; }Signature · 1 line
2.55.0
Paolo Abeni
maintainerQuoted 8 lines · Hamza Mahfooz
Quoted 7 lines · Muhammad Falak R Wani
mana_bpf()declares an uninitialized 'ret' and falls through to a trailing 'return ret;' after a switch statement whose every case (XDP_SETUP_PROGand default) already returns unconditionally. This statement is therefore unreachable dead code left over from an earlier refactor, and it would return an uninitialized value if it were ever reached.
Quoted 6 lines
Quoted 3 lines
Drop the unused variable and the unreachable return.
Signed-off-by Muhammad Falak R Wani <[email protected]>Fixes ed5356b53f07 ("net: mana: Add XDP support")Reviewed-by Hamza Mahfooz <[email protected]>
Please note that the current guidance is no fixes tag for net-next changes.
Also this specific change does not address any real issue, it's just code cleanup.
/P
Paolo Abeni
maintainerQuoted 10 lines · Muhammad Falak R Wani
mana_bpf()declares an uninitialized 'ret' and falls through to a trailing 'return ret;' after a switch statement whose every case (XDP_SETUP_PROGand default) already returns unconditionally. This statement is therefore unreachable dead code left over from an earlier refactor, and it would return an uninitialized value if it were ever reached.Drop the unused variable and the unreachable return.
Signed-off-by Muhammad Falak R Wani <[email protected]>
## Form letter - net-next-closed
net-next pull request for v7.3 has already been merged, and therefore the net-next tree is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.
Please repost when net-next reopens after Aug 31st.
RFC patches sent for review only are obviously welcome at any time.
See:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
Signature · 2 lines
pw-bot: defer pv-bot: closed