From patchwork Mon Mar 20 07:29:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 125258 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1029442397; Mon, 20 Mar 2023 09:01:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB01D40A7F; Mon, 20 Mar 2023 09:01:49 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id DA654406BC for ; Mon, 20 Mar 2023 09:01:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679299308; x=1710835308; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vcKf3qBFyA6r6DyvC+CDjUBIvdDB2sjTm0NvL4iTqzs=; b=Dvwu2y3yra/cpEEzt3jk2KWoOAEybveUKerenKnCGk8OPyGRSVsfX/7C 6tV2WFNk2eYHtfp1EGnJt9ZGQrgLmwd9WUsBwgFnyuiU/bbsMl1mQiHBd yQw/TNvH6gazWqxmFcBKyvMTYt8AzNxgffcT3WD7ilH3UkwDLWW6II13o LWMhFbqPV5aq2Y+D4/TXKmTfdOPufFXiprj91TDLX4apDRoEPOy3p+1qv 5kfvoMgOUsCdMH5OKr83eAzdmZ2BLrpDYZ/8O4MiFmIwCVi+6ZLRmO03i tIUznl3VAG6GojVaYZBAGehPo59AJHlLsMvt1NfpdD416gXBdnE0EyYHH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="336101151" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="336101151" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 01:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="855193713" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="855193713" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by orsmga005.jf.intel.com with ESMTP; 20 Mar 2023 01:01:45 -0700 From: beilei.xing@intel.com To: yuying.zhang@intel.com Cc: dev@dpdk.org, Beilei Xing Subject: [PATCH] net/cpfl: cancel alarm when fail to init adapter Date: Mon, 20 Mar 2023 07:29:37 +0000 Message-Id: <20230320072937.84847-1-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 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 From: Beilei Xing Cancel alarm if failing to allocate vports memory during adapter_ext initialization. Otherwise, there'll be segmentation fault when fail to initialize adapter_ext. Fixes: 2d823ecd671c ("net/cpfl: support device initialization") Signed-off-by: Beilei Xing Acked-by: Qi Zhang --- drivers/net/cpfl/cpfl_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index 54261d5743..ede730fd50 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1199,7 +1199,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a if (adapter->vports == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate vports memory"); ret = -ENOMEM; - goto err_get_ptype; + goto err_vports_alloc; } adapter->cur_vports = 0; @@ -1209,7 +1209,8 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a return ret; -err_get_ptype: +err_vports_alloc: + rte_eal_alarm_cancel(cpfl_dev_alarm_handler, adapter); idpf_adapter_deinit(base); err_adapter_init: return ret;