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 591EF46142; Tue, 28 Jan 2025 18:42:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F2F7D40615; Tue, 28 Jan 2025 18:42:31 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 425E940144 for ; Tue, 28 Jan 2025 18:42:30 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21631789fcdso93244945ad.1 for ; Tue, 28 Jan 2025 09:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1738086149; x=1738690949; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RZwNuQtP4wOFVmMXPsYjtIYMlXMHvVQLpDh+XmGRe70=; b=Bd1k8IACNJJszruExSXLoYXZM6iWosko4iePRNUOq4A0jenAif7EyXChTfBZd6q8xA B5fwwWcqknR2WkYvWYX4DWWlBcvYrgRzP1rC10FjydZJEwFMEmHlltmdrn+NPEMXvCFM iB0PISEgROEiE9VsRcxQMa5f51qhp5JqCMTZ9s+jKf+IzQrDjVVD6/DQERTolbQX2Igs 0H2/hMagrvcfOcVUxqVcODKoCn/ZTpY3bdqixl6xRlFuRsrylwr1yDp5ZtEGaa9T9KUV NtTTaqzF9Bh5cUtIiS0W6vEqxtAYf2T1VdDX68mN1KUTuILpIKX+rE6PVpnEwsDurt/d VPWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738086149; x=1738690949; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RZwNuQtP4wOFVmMXPsYjtIYMlXMHvVQLpDh+XmGRe70=; b=XERnXYJ6wPTLBPup4yh439EIrT63Vw1onWGgSM8eMqXtQ8bxBVWjaCsVBETISg+U1f awiJNMADdZ+eopB9pWZV99lvcTwaxyAfciGHH8CX7PZCwpHDAYhv6W0vhfLnfyASSuKg msg+M9y4tJ5disN+9XbQWVaMFpoQAZ/04pyfBZKw5ZTAZzBQGjGzrLgHSOF0arKYAr9h V1xrMCaRNG9XEft7PlhFY++aJcnjzTOhHcxhzdCIWDNvwSXvDh1lCxI1Z1wURdypWmzD MXj+jQLbyBJL95a7kJQ3HH2uj8mTCftz8aX5Lf+VofwK+TIkJZOkYH7eM55J0zCcCW6T ggag== X-Gm-Message-State: AOJu0YyKG2bTXyJ564KgZazkdUuA2JNNtyI9D2cRTz42JlWHOZVZrKD8 1HekMTebYNMHtZfi89K59cWfNinK4TD64/Zua3CuH+ILetoRtcFRvgHxl2PQzJPUNlo0XQqOZT3 i X-Gm-Gg: ASbGncuzpmzuy88akhMj9nVz2XFsoCmWUpHdn9f6RSMrntyPzpXgZLh+7Q2jRxZJdV3 4++zZuUkPDW8XKSsUr2SBRrFHJfYOd81i1T9fKv/bJm1Z8XP2BYgq3pWP533tYkrHqVbXR8nWB4 wR25omo2elQy7KFJfAs7kYGLNEuqppxm4rEh7epfU0My9YiOuVidqrOzyI3p6bCdWllktT08iGl t2LDAejZqArS4UkO9IslGAyJBcMJIcCWe+mt8YKUR94hfYajlhr0S488icEYgzygtMpdhkCmhlY RjG86GTC6x3uExf8VJpnxFJYsqoib+7BFyw/Y/ZoK7pOqSZTXPByhBtHKsAWgS2RJrEG X-Google-Smtp-Source: AGHT+IE675aqMO8RR6qhx4fveCX5Zg0RqPjAf1vcPyaS0pdkfcqRxwXotPM/YJbhaMx0ZkbuR5cSPQ== X-Received: by 2002:a05:6a21:78c:b0:1e1:9e9f:ae4 with SMTP id adf61e73a8af0-1ed7a5ef401mr191023637.13.1738086149193; Tue, 28 Jan 2025 09:42:29 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac495d57b7asm8575708a12.52.2025.01.28.09.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 09:42:28 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ajit Khaparde , Somnath Kotur Subject: [PATCH] net/bnxt: remove unnecessary checks for null pointer Date: Tue, 28 Jan 2025 09:42:19 -0800 Message-ID: <20250128174219.155796-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.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 The function rte_free() handles a NULL pointer as no-op. This patch was automatically generated from nullfree.cocci script. Signed-off-by: Stephen Hemminger --- drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 6 ++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 3 +-- drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c index 1770069295..f88299bbf7 100644 --- a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c +++ b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c @@ -1668,10 +1668,8 @@ int tfc_tbl_scope_cpm_alloc(struct tfc *tfcp, uint8_t tsid, return 0; cleanup: - if (cmm_lkup != NULL) - rte_free(cmm_lkup); - if (cmm_act != NULL) - rte_free(cmm_act); + rte_free(cmm_lkup); + rte_free(cmm_act); return rc; } diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 2429ac2f1a..49cd6620dd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -1359,8 +1359,7 @@ ulp_mapper_key_recipe_tbl_deinit(struct bnxt_ulp_mapper_data *mdata) recipes = mdata->key_recipe_info.recipes[dir][ftype]; for (idx = 0; idx < mdata->key_recipe_info.num_recipes; idx++) { - if (recipes[idx]) - rte_free(recipes[idx]); + rte_free(recipes[idx]); } rte_free(mdata->key_recipe_info.recipes[dir][ftype]); mdata->key_recipe_info.recipes[dir][ftype] = NULL; diff --git a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c index 5fa8e240db..85b72f328c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c @@ -158,11 +158,9 @@ ulp_sc_mgr_deinit(struct bnxt_ulp_context *ctxt) if (!ulp_sc_info) return -EINVAL; - if (ulp_sc_info->stats_cache_tbl) - rte_free(ulp_sc_info->stats_cache_tbl); + rte_free(ulp_sc_info->stats_cache_tbl); - if (ulp_sc_info->read_data) - rte_free(ulp_sc_info->read_data); + rte_free(ulp_sc_info->read_data); rte_free(ulp_sc_info); -- 2.45.2