From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5850C454DF; Mon, 24 Jun 2024 12:02:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B62BA40DCD; Mon, 24 Jun 2024 12:02:35 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mails.dpdk.org (Postfix) with ESMTP id AF7934026E for ; Mon, 24 Jun 2024 12:02:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719223335; x=1750759335; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kq/PQeswvZBF6RBJLn5LrpUvySk2YkZ/faoCbAZeZf8=; b=cShoNC84WvB4cr9avWLeaQwWAnBV5vbqXliF54DbvkzQvur7rpEu/9Mw mANzf4MHqnu+8bCEj2sz+b6Crtz/McHG3btGzZiCAZsI+9FYMZqa5aHcX fp/hWwmzL1nhbSs0NtSqaHD3C8nLDTaffEPuGUNdCDORkbR3WXMB5Nqvs 2K1I6lk5LApnBaMcqVWnH1HVF2oozRJqfVEUjgFlw9/ScjE1vGdjptNVw s4bDYtASNwRtsXm3bfljmXQdr1yHbKqpuDO5MhuJoXqsSuF0Dtq4Jo3MX 34pkmEW+GbfuL1K4Z0k4pFDuBpnsYycHagdy9Z9h7PkgDCZKorK3LmCCa g==; X-CSE-ConnectionGUID: hz+6VtU+RUaMKt79CLcTOg== X-CSE-MsgGUID: bACdD1XqRzqIB/6iG6PBUA== X-IronPort-AV: E=McAfee;i="6700,10204,11112"; a="19086384" X-IronPort-AV: E=Sophos;i="6.08,261,1712646000"; d="scan'208";a="19086384" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2024 03:02:14 -0700 X-CSE-ConnectionGUID: w0GwSU0jSUKZlZDE1pgdvw== X-CSE-MsgGUID: fnyLnbHGRgWdWXy4j2rvaw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,261,1712646000"; d="scan'208";a="74479020" Received: from unknown (HELO npf-hyd-clx-03..) ([10.145.170.182]) by fmviesa001.fm.intel.com with ESMTP; 24 Jun 2024 03:02:13 -0700 From: Soumyadeep Hore To: bruce.richardson@intel.com, anatoly.burakov@intel.com Cc: dev@dpdk.org Subject: [PATCH v5 04/21] common/idpf: avoid defensive programming Date: Mon, 24 Jun 2024 09:16:27 +0000 Message-ID: <20240624091644.2404658-5-soumyadeep.hore@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240624091644.2404658-1-soumyadeep.hore@intel.com> References: <20240618105722.2326987-22-soumyadeep.hore@intel.com> <20240624091644.2404658-1-soumyadeep.hore@intel.com> 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 Based on the upstream feedback, driver should not use any defensive programming strategy by checking for NULL pointers and other conditional checks unnecessarily in the code flow to fall back, instead fail and fix the bug in a proper way. As the control queue is freed and deleted from the list after the idpf_ctlq_shutdown call, there is no need to have the ring_size check in idpf_ctlq_shutdown. Signed-off-by: Soumyadeep Hore --- drivers/common/idpf/base/idpf_controlq.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/common/idpf/base/idpf_controlq.c b/drivers/common/idpf/base/idpf_controlq.c index a82ca628de..d9ca33cdb9 100644 --- a/drivers/common/idpf/base/idpf_controlq.c +++ b/drivers/common/idpf/base/idpf_controlq.c @@ -98,9 +98,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) { idpf_acquire_lock(&cq->cq_lock); - if (!cq->ring_size) - goto shutdown_sq_out; - #ifdef SIMICS_BUILD wr32(hw, cq->reg.head, 0); wr32(hw, cq->reg.tail, 0); @@ -115,7 +112,6 @@ static void idpf_ctlq_shutdown(struct idpf_hw *hw, struct idpf_ctlq_info *cq) /* Set ring_size to 0 to indicate uninitialized queue */ cq->ring_size = 0; -shutdown_sq_out: idpf_release_lock(&cq->cq_lock); idpf_destroy_lock(&cq->cq_lock); } -- 2.43.0