From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF490EB64DD for ; Fri, 21 Jul 2023 02:42:34 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C4F340DF8; Fri, 21 Jul 2023 04:42:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B5BA340DD8 for ; Fri, 21 Jul 2023 04:42:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689907351; x=1721443351; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=YhsgI1aL5+66o5ZJjHMEP+Ovq1A14WVhSlEgek2O6Vs=; b=XQocrIokCp3pMr0gzTl5gxCXSPuSVZVPD+gzEoqbTpVPyeLr+/1+lnZ9 8fkT70Nu5jzT6Z2ArQuQ3juTPYoynZ+I1SMSQTqkjQxkdtoQ/MfHX0wnp K0I8XgSJYOTdqRH+CWSi3Jq1NcyZfMteX8D92CNaIQItfsESpD09nS67H IncDT8NfMZUpDIE1EItvm5ljaTQYOzSXGYjB4VfbyV4AJ7YDYIXGHosP9 p947JnNilwqVF2o4tUoBUp5gwf2JMsiiyM0toYlXTSN7gLw5bNEF1VuyF lQzAHB97rhsQWpGF4qxUkXBzADPVW3TRI0N26NJFuV2CSn11hm5+K353n w==; X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="364386762" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="364386762" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 19:42:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="794803364" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="794803364" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.119.138]) by fmsmga004.fm.intel.com with ESMTP; 20 Jul 2023 19:42:29 -0700 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com Cc: Zhirun Yan Subject: [PATCH v1] test/graph: fix unused return value Date: Fri, 21 Jul 2023 10:13:16 +0800 Message-Id: <20230721021316.1473047-1-zhirun.yan@intel.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Return value stored in "ret" but it may be overwritten before use. Add goto to return when meet an error. Issue reported by coverity scan. Coverity issue: 395532 Fixes: 15f483feec65 ("graph: fix model check in core binding") Signed-off-by: Zhirun Yan --- app/test/test_graph.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index af90ac07ec..7995f67757 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -740,13 +740,13 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void) ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH); if (ret != 0) { printf("Set graph mcore dispatch model failed\n"); - ret = -1; + goto fail; } ret = rte_graph_model_mcore_dispatch_core_bind(cloned_graph_id, worker_lcore); if (ret != 0) { printf("bind graph %d to lcore %u failed\n", graph_id, worker_lcore); - ret = -1; + goto fail; } graph = rte_graph_lookup("worker0-cloned-test2"); @@ -755,6 +755,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void) printf("bind graph %s(id:%d) with lcore %u failed\n", graph->name, graph->id, worker_lcore); ret = -1; + goto fail; } rte_graph_model_mcore_dispatch_core_unbind(cloned_graph_id); @@ -764,6 +765,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void) ret = -1; } +fail: rte_graph_destroy(cloned_graph_id); return ret; @@ -781,7 +783,7 @@ test_graph_worker_model_set_get(void) ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH); if (ret != 0) { printf("Set graph mcore dispatch model failed\n"); - ret = -1; + goto fail; } graph = rte_graph_lookup("worker0-cloned-test3"); @@ -790,9 +792,10 @@ test_graph_worker_model_set_get(void) ret = -1; } +fail: rte_graph_destroy(cloned_graph_id); - return 0; + return ret; } static int -- 2.37.2