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 E4B18A0353; Fri, 21 Jan 2022 13:04:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9D2542755; Fri, 21 Jan 2022 13:04:49 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EEDA042755 for ; Fri, 21 Jan 2022 13:04:47 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20LAUpWJ015267; Fri, 21 Jan 2022 04:04:47 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=r6tJJi6TjMky/68WY8csgGvqY2seBa8JFKrLXt8N/e8=; b=FfkUER7leG8gDCxW6WTtR+TZKjOGcBnu5rJc0IKcxBvPCZvrwJEs6sC7xa0OTlUxlCVh lEsmog/5GyldT29acwkX2QDib3oRzHKUQmOqRjaRNamRqbP5I09/z+ZAKqgjDMzdSJEw wd9ntH2PKOXm6LVd0XRVwcIy1+BnoGBsHvzTMSy5vEl6fKQcUMpmXc1GZYG38lgO/cvX GhLRNonTaUfCLRIiWnCZjJKtJosiy+/IMHbC6pT5meJ3w3J/j6IVKSrLYnlx7eVlzt8+ jJU4lAbXUU2Vlzzo9fWP2pLCt6AhqZzwdgc+x9Dl5SU93svBfK0F1mLzg+iJvclo1TBc ew== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dqhytsw7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 21 Jan 2022 04:04:46 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 21 Jan 2022 04:04:40 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 21 Jan 2022 04:04:40 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 136DA3F7095; Fri, 21 Jan 2022 04:04:36 -0800 (PST) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan , Shijith Thotton Subject: [PATCH v2 02/10] common/cnxk: use for loop in shaper profiles cleanup Date: Fri, 21 Jan 2022 17:34:16 +0530 Message-ID: <20220121120424.28166-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20220121120424.28166-1-ndabilpuram@marvell.com> References: <20211209091342.27017-1-ndabilpuram@marvell.com> <20220121120424.28166-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: vMRW2YCTr80z3lQbeMLFf4RuqYJsS6Im X-Proofpoint-GUID: vMRW2YCTr80z3lQbeMLFf4RuqYJsS6Im X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-21_06,2022-01-21_01,2021-12-02_01 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: Gowrishankar Muthukrishnan In shaper profiles cleanup, Klockwork static analyzer tool reports infinite loop although existing loop condition is alright. False positive may be due to tqh_first not checked in loop, hence switching to FOREACH_SAFE to make Klockwork happy. Signed-off-by: Gowrishankar Muthukrishnan Signed-off-by: Shijith Thotton Acked-by: Jerin Jacob --- drivers/common/cnxk/roc_nix_tm.c | 8 ++++---- drivers/common/cnxk/roc_platform.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c index b3d8ebd..fe9e83f 100644 --- a/drivers/common/cnxk/roc_nix_tm.c +++ b/drivers/common/cnxk/roc_nix_tm.c @@ -17,16 +17,16 @@ bitmap_ctzll(uint64_t slab) void nix_tm_clear_shaper_profiles(struct nix *nix) { - struct nix_tm_shaper_profile *shaper_profile; + struct nix_tm_shaper_profile *shaper_profile, *tmp; + struct nix_tm_shaper_profile_list *list; - shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list); - while (shaper_profile != NULL) { + list = &nix->shaper_profile_list; + PLT_TAILQ_FOREACH_SAFE(shaper_profile, list, shaper, tmp) { if (shaper_profile->ref_cnt) plt_warn("Shaper profile %u has non zero references", shaper_profile->id); TAILQ_REMOVE(&nix->shaper_profile_list, shaper_profile, shaper); nix_tm_shaper_profile_free(shaper_profile); - shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list); } } diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h index 85aa6dc..adcd2fa 100644 --- a/drivers/common/cnxk/roc_platform.h +++ b/drivers/common/cnxk/roc_platform.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "roc_bits.h" @@ -53,6 +54,7 @@ #define BITMASK_ULL GENMASK_ULL #define PLT_ALIGN_CEIL RTE_ALIGN_CEIL #define PLT_INIT RTE_INIT +#define PLT_TAILQ_FOREACH_SAFE RTE_TAILQ_FOREACH_SAFE /** Divide ceil */ #define PLT_DIV_CEIL(x, y) \ -- 2.8.4