Re: [PATCH] staging: octeon: replace BUG() with WARN_ON_ONCE() in cvn_oct_xmit()

From: Greg KH

Date: Mon Mar 09 2026 - 12:41:36 EST


On Wed, Mar 04, 2026 at 04:53:16PM -0800, Mark Adamenko wrote:
> All three values of queue_type are handled in the switch case, making
> the default case unreachable. Replace BUG() with WARN_ON_ONCE() to avoid
> an unnecessary kernel crash if reached.
>
> Signed-off-by: Mark Adamenko <marusik.adamenko@xxxxxxxxx>
> ---
> drivers/staging/octeon/ethernet-tx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> index f5bbedac6a65..f34d82a433e3 100644
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ b/drivers/staging/octeon/ethernet-tx.c
> @@ -450,7 +450,8 @@ netdev_tx_t cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
> __skb_queue_tail(&priv->tx_free_list[qos], skb);
> break;
> default:
> - BUG();
> + WARN_ON_ONCE(1);
> + break;

If this is impossible to ever hit, then nothing changed here, right? So
why is this even needed?

thanks,

greg k-h