From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 937FDA0556; Thu, 20 Feb 2020 18:39:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE59C1BF99; Thu, 20 Feb 2020 18:39:11 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 0EC6958C4 for ; Thu, 20 Feb 2020 18:39:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2020 09:39:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,465,1574150400"; d="scan'208";a="229552380" Received: from silpixa00393944.ir.intel.com ([10.237.223.184]) by orsmga008.jf.intel.com with ESMTP; 20 Feb 2020 09:39:06 -0800 From: Hariprasad Govindharajan To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, ferruh.yigit@intel.com, stephen@networkplumber.org, david.marchand@redhat.com, Hariprasad Govindharajan Date: Thu, 20 Feb 2020 17:39:03 +0000 Message-Id: <1582220343-22149-1-git-send-email-hariprasad.govindharajan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582205191-14105-1-git-send-email-hariprasad.govindharajan@intel.com> References: <1582205191-14105-1-git-send-email-hariprasad.govindharajan@intel.com> Subject: [dpdk-dev] [PATCH v3] app/testpmd: fix return value in portlist parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The function parse_port_list() is designed to return unsigned int value. After sanitizing the inputs, it is returning -1. Changed it to return 0. Fixes: 2df00d562d20 ("app/testpmd: add --portlist option") Cc: hariprasad.govindharajan@intel.com Signed-off-by: Hariprasad Govindharajan --- v3: corrected the documentation comments. updated the comments on return values. v2: modified the head line in the patch --- app/test-pmd/config.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9d95202..e9b89c4 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2616,9 +2616,6 @@ set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt) * If the user wants to use only the ports 1,2 then the input * is 1,2. * valid characters are '-' and ',' - * invalid chars like '.' or '#' will result in - * EAL: Error - exiting with code: 1 - * Cause: Invalid fwd port list * @param[out] values * This array will be filled with a list of port IDs * based on the user input @@ -2630,7 +2627,8 @@ set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt) * 1) Number of elements in the values array * 2) Maximum value of each element in the values array * @return - * -returns total count of parsed port IDs + * On success, returns total count of parsed port IDs + * On failure, returns 0 */ static unsigned int parse_port_list(const char *list, unsigned int *values, unsigned int maxsize) @@ -2642,7 +2640,7 @@ parse_port_list(const char *list, unsigned int *values, unsigned int maxsize) unsigned int marked[maxsize]; if (list == NULL || values == NULL) - return -1; + return 0; for (i = 0; i < (int)maxsize; i++) marked[i] = 0; -- 2.7.4