DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Xueqin Lin <xueqin.lin@intel.com>,
	Zhihong Peng <zhihongx.peng@intel.com>
Subject: [dpdk-dev] [PATCH] pipeline: remove unreachable branch
Date: Wed,  3 Nov 2021 07:56:58 +0100	[thread overview]
Message-ID: <20211103065658.8100-1-david.marchand@redhat.com> (raw)

A previous change blamed it on compiler/ASan, while this is a real
(yet minor) issue.

This return -EINVAL is never reached since we test all combinations of
fidx and fcin booleans.
All branches end up with a return 0, factorize them.

Fixes: 84f5ac9418ea ("pipeline: fix build with ASan")
Fixes: f38913b7fb8e ("pipeline: add meter array to SWX")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
---
 lib/pipeline/rte_swx_pipeline.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index 1afaffefd4..0bdda7e0b3 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -4539,8 +4539,6 @@ instr_meter_translate(struct rte_swx_pipeline *p,
 		instr->meter.color_out.struct_id = (uint8_t)color_out_struct_id;
 		instr->meter.color_out.n_bits = fcout->n_bits;
 		instr->meter.color_out.offset = fcout->offset / 8;
-
-		return 0;
 	}
 
 	/* index = HMEFT, length = HMEFT, color_in = I, color_out = MEF. */
@@ -4575,8 +4573,6 @@ instr_meter_translate(struct rte_swx_pipeline *p,
 		instr->meter.color_out.struct_id = (uint8_t)color_out_struct_id;
 		instr->meter.color_out.n_bits = fcout->n_bits;
 		instr->meter.color_out.offset = fcout->offset / 8;
-
-		return 0;
 	}
 
 	/* index = I, length = HMEFT, color_in = MEFT, color_out = MEF. */
@@ -4607,8 +4603,6 @@ instr_meter_translate(struct rte_swx_pipeline *p,
 		instr->meter.color_out.struct_id = (uint8_t)color_out_struct_id;
 		instr->meter.color_out.n_bits = fcout->n_bits;
 		instr->meter.color_out.offset = fcout->offset / 8;
-
-		return 0;
 	}
 
 	/* index = I, length = HMEFT, color_in = I, color_out = MEF. */
@@ -4638,11 +4632,9 @@ instr_meter_translate(struct rte_swx_pipeline *p,
 		instr->meter.color_out.struct_id = (uint8_t)color_out_struct_id;
 		instr->meter.color_out.n_bits = fcout->n_bits;
 		instr->meter.color_out.offset = fcout->offset / 8;
-
-		return 0;
 	}
 
-	return -EINVAL;
+	return 0;
 }
 
 static inline void
-- 
2.23.0


             reply	other threads:[~2021-11-03  6:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  6:56 David Marchand [this message]
2021-11-03 12:55 ` Dumitrescu, Cristian
2021-11-04 17:20   ` Thomas Monjalon

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=20211103065658.8100-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=xueqin.lin@intel.com \
    --cc=zhihongx.peng@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;
as well as URLs for NNTP newsgroup(s).