From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 73C2FA0C53;
	Wed,  3 Nov 2021 07:57:15 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 34F7D40E0F;
	Wed,  3 Nov 2021 07:57:15 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id E037F40E03
 for <dev@dpdk.org>; Wed,  3 Nov 2021 07:57:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1635922633;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding;
 bh=LEUzjCclFPLNjls6qgDH1Ma97Ep+l3b6OtSI84/Gk7A=;
 b=FX5QtLkVJxufAcvkwUjc5u/fBsVDTe2lK5X8SqvmMI+eEM97fPJpf7Lo5ZQ32UJ80t9FVA
 gZZTTG/yFYnPW7aPwRjwwALsoNz6+gdnbvOObxTSkuoxPHyFQjJwHYn6JxSFUF0zTtnrss
 GIod9KlFFo7l3DYVjMAdr5vfTTAh9Y4=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-436-t1TeDvsvNYWeniQuS-828A-1; Wed, 03 Nov 2021 02:57:08 -0400
X-MC-Unique: t1TeDvsvNYWeniQuS-828A-1
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
 [10.5.11.12])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BFBB1023F4F;
 Wed,  3 Nov 2021 06:57:07 +0000 (UTC)
Received: from dmarchan.remote.csb (unknown [10.40.192.22])
 by smtp.corp.redhat.com (Postfix) with ESMTP id D4B8D60C05;
 Wed,  3 Nov 2021 06:57:05 +0000 (UTC)
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>
Date: Wed,  3 Nov 2021 07:56:58 +0100
Message-Id: <20211103065658.8100-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"
Subject: [dpdk-dev] [PATCH] pipeline: remove unreachable branch
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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