From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Yipeng Wang <yipeng1.wang@intel.com>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbox@nvidia.com>
Subject: [PATCH 32/37] lib: remove unreachable statements
Date: Sun, 29 Nov 2026 16:27:17 -0800 [thread overview]
Message-ID: <20261130002752.2342213-33-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130002752.2342213-1-stephen@networkplumber.org>
Clang with -Wunreachable-code-aggressive reports break statements
after a return and returns after a switch where every case
returns.
Remove them. Extra defensive code does not help: with the trailing
return gone, adding a case that forgets to return becomes a
compiler error instead of silently returning zero.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/cmdline/cmdline_parse_num.c | 2 --
lib/efd/rte_efd.c | 6 ------
lib/fib/rte_fib.c | 1 -
lib/fib/rte_fib6.c | 1 -
lib/sched/rte_sched.c | 1 -
lib/vhost/vhost_crypto.c | 1 -
6 files changed, 12 deletions(-)
diff --git a/lib/cmdline/cmdline_parse_num.c b/lib/cmdline/cmdline_parse_num.c
index 4cfc900391..ab2a55eb82 100644
--- a/lib/cmdline/cmdline_parse_num.c
+++ b/lib/cmdline/cmdline_parse_num.c
@@ -285,7 +285,6 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,
} else {
return -1;
}
- break;
case DEC_NEG_OK:
if (nd.type == RTE_INT8 &&
@@ -307,7 +306,6 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res,
} else {
return -1;
}
- break;
default:
debug_printf("error\n");
return -1;
diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 4dfc0ec9a4..9d5969e151 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -1286,8 +1286,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
const uint32_t hash_val_a, const uint32_t hash_val_b,
enum efd_lookup_internal_function lookup_fn)
{
- efd_value_t value = 0;
-
switch (lookup_fn) {
#if defined(RTE_ARCH_X86)
@@ -1296,7 +1294,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
group->lookup_table,
hash_val_a,
hash_val_b);
- break;
#endif
#if defined(RTE_ARCH_ARM64)
case EFD_LOOKUP_NEON:
@@ -1304,7 +1301,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
group->lookup_table,
hash_val_a,
hash_val_b);
- break;
#endif
case EFD_LOOKUP_SCALAR:
/* Fall-through */
@@ -1314,8 +1310,6 @@ efd_lookup_internal(const struct efd_online_group_entry * const group,
hash_val_a,
hash_val_b);
}
-
- return value;
}
RTE_EXPORT_SYMBOL(rte_efd_lookup)
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 184210f380..17909f0759 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -115,7 +115,6 @@ init_dataplane(struct rte_fib *fib, __rte_unused int socket_id,
default:
return -EINVAL;
}
- return 0;
}
RTE_EXPORT_SYMBOL(rte_fib_add)
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 770becdb61..e2cbf0db25 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -113,7 +113,6 @@ init_dataplane(struct rte_fib6 *fib, __rte_unused int socket_id,
default:
return -EINVAL;
}
- return 0;
}
RTE_EXPORT_SYMBOL(rte_fib6_add)
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index daa31e8b99..1f0d99d40b 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -2920,7 +2920,6 @@ grinder_handle(struct rte_sched_port *port,
default:
rte_panic("Algorithmic error (invalid state)\n");
- return 0;
}
}
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 38a7bd75d6..da59d84126 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -107,7 +107,6 @@ cipher_algo_transform(uint32_t virtio_cipher_algo,
break;
default:
return -VIRTIO_CRYPTO_BADMSG;
- break;
}
return 0;
--
2.53.0
next prev parent reply other threads:[~2026-11-30 0:31 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30 0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
2026-11-30 9:13 ` Bruce Richardson
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
2026-11-30 0:26 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Stephen Hemminger
2026-11-30 9:52 ` Radu Nicolau
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
2026-11-30 9:16 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
2026-11-30 9:43 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
2026-11-30 9:44 ` Bruce Richardson
2026-11-30 0:27 ` Stephen Hemminger [this message]
2026-11-30 0:27 ` [PATCH 33/37] app: remove unreachable statements Stephen Hemminger
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
2026-11-30 9:45 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
2026-11-30 10:59 ` Dariusz Sosnowski
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130002752.2342213-33-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=chenbox@nvidia.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox