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 EBCDDA00C2; Sun, 20 Feb 2022 01:52:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAC7F41152; Sun, 20 Feb 2022 01:51:50 +0100 (CET) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 11A24410FA for ; Sun, 20 Feb 2022 01:51:48 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id q11-20020a17090a304b00b001b94d25eaecso11891452pjl.4 for ; Sat, 19 Feb 2022 16:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HP50AnJLQFaAeX74twilP1G6y4PxcwD69EyDyAwScTU=; b=1aUSokUEO0sBneFQG0CMVciDsbKObkKrcvCMPScgfG7oFEONr63j6RgU9OaZPWeuJC 2EBj5KTNwRYzZ96jcrrdKnuihJelzj1dj7kBlJRYaRrGmaHFaeEvgLYsMd/HEgwSrUbq GpHEWuaPo9+lAR0qrjOtxk48mpSyaFdcbxLEBSqOu8vx+F5PMoYK/WiYJ38UX4AR1rIW dm8gSe5UGCbn17BLuTK40sqO8SVCWvlZfnZ0YrBoNgzWgUjCjUK0oxffflk14TYHgLJA ED8Yf+QYKoyjgeF/Aox+f3Yicd7mlzt8Sltfh7sDZSzczJk7t398E3kFUdn8YlPj2DXh iWtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HP50AnJLQFaAeX74twilP1G6y4PxcwD69EyDyAwScTU=; b=bCTcHT7MCoqO2/cz91HjHSnodh8kjYlvSCbIZc7YgmQUtjC1a36nKn+DNR74E2Hc1P YHN1MCn++e85yvXEAJEwIG09KUMArSvONMCR7OYILTSmq5B2AgBnYtsZkDUsl3kfTHxP g5QjLTxs1biY8GujOEpqAEON099HxBWuHmgU3uQsxQxssa6IaUtXwxj02/Lva7ErJ2J5 qf+FjHMeluVMT8fA6jBDGa/WPiGPTQEVZtFgc8NUzNjKdGyxGiiCV65fRuBw1SAIdRB5 kf5jfeCDItfQ9sbPdWmnVtyj5Ef8dOl0iZl1zwZNcVyg1u6RZZ20qRvw7sfGvSxcKUSR iPUA== X-Gm-Message-State: AOAM532dZzsBvejERYoR5CLNuvnVsrMeaCXFCiIkiP6wFTqnWD5/F89j CLwfSqyKYLNMoJbexBuYIRK4LzZi3FN2LW2O X-Google-Smtp-Source: ABdhPJw9j3QXM28Jp+gEn2VO5JqGUhYx1imZjQnz5w0KpUbjGP+HrPMXhHDN4e/1oSbddtQIXhl5jA== X-Received: by 2002:a17:90a:9309:b0:1bc:1bf1:dad4 with SMTP id p9-20020a17090a930900b001bc1bf1dad4mr1799732pjo.169.1645318306904; Sat, 19 Feb 2022 16:51:46 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id f7sm8129695pfc.0.2022.02.19.16.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 16:51:46 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson , Vladimir Medvedkin , Anatoly Burakov , Olivier Matz , Andrew Rybchenko , Yipeng Wang , Sameh Gobriel , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH v2 3/7] lpm: remove unnecessary NULL checks Date: Sat, 19 Feb 2022 16:51:36 -0800 Message-Id: <20220220005140.78713-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220005140.78713-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220005140.78713-1-stephen@networkplumber.org> 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 functions rte_lpm_free() and rte_lpm6_free() already handle NULL pointer case. Signed-off-by: Stephen Hemminger --- app/test/test_func_reentrancy.c | 3 +-- lib/lpm/rte_lpm.h | 1 + lib/lpm/rte_lpm6.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index da00694daafd..67e69ad53588 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -348,8 +348,7 @@ lpm_clean(unsigned int lcore_id) int i; lpm = rte_lpm_find_existing("fr_test_once"); - if (lpm != NULL) - rte_lpm_free(lpm); + rte_lpm_free(lpm); for (i = 0; i < MAX_LPM_ITER_TIMES; i++) { snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_id, i); diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h index 5eb14c1748e5..a50bf3339fee 100644 --- a/lib/lpm/rte_lpm.h +++ b/lib/lpm/rte_lpm.h @@ -183,6 +183,7 @@ rte_lpm_find_existing(const char *name); * * @param lpm * LPM object handle + * If NULL then, the function does nothing. * @return * None */ diff --git a/lib/lpm/rte_lpm6.h b/lib/lpm/rte_lpm6.h index f96f3372e593..145fd4495a94 100644 --- a/lib/lpm/rte_lpm6.h +++ b/lib/lpm/rte_lpm6.h @@ -73,6 +73,7 @@ rte_lpm6_find_existing(const char *name); * * @param lpm * LPM object handle + * If NULL then, the function does nothing. * @return * None */ -- 2.34.1