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 ECC4BA00C4; Sun, 20 Feb 2022 00:43:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23E4941151; Sun, 20 Feb 2022 00:43:31 +0100 (CET) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id F2C4E41147 for ; Sun, 20 Feb 2022 00:43:28 +0100 (CET) Received: by mail-pj1-f54.google.com with SMTP id qe15so11657871pjb.3 for ; Sat, 19 Feb 2022 15:43:28 -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=qEihVze8WeNbSIYY6XPap8pQlRP+FFQ9kTtB3C+eCsI=; b=uTteZuv2quUSgiaJ8CG5T3nr5JhfFKM/keHCaKvKD8IOZ8K4t+EAw7vaySwgrClpSM d8c7paOTl/6OaKZDR0v2em92fQZeRXYQu8Ydm2/x6e+SxBmZD0xrkjoS+DO+tkgyS0ms NaAdSmFNVcimCHLn2GF06c3soSlyBIf8oXk6wS5uN40nN1i62J2wuYyGIyLJ9zhAXx+e EUdjFL1kJiwV8cJ+bcVrySpxzQ/JR0vlxwgaOl2CzrkIkyM3pFC69yzEK8SZG4woHZfS 6fXsUfkju34Twz9p5oCzrWADThyrMH8kD3YBcOtHIZ2UAOxH8SPAKdPNbUy3u35fSy29 ow+Q== 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=qEihVze8WeNbSIYY6XPap8pQlRP+FFQ9kTtB3C+eCsI=; b=muxv0WcPt0BNlRS2fyyS2bX+H/4/i0lIXHTV8kELWXZwMkMwfYIeXv7c6o2bljQmEy xIPxKcXhafI8U49H4HqART4OendEybeo5AAxtk3BsfdGMqb5qzyJFUXwoXWv3zC11ibr mU/zwWK9sX6kr1wSDjnEedeBxoWxCFg2Bk3ZqDE1wopXFXkfMsktUBzyfDYC3ofplj+7 mGafTWyqc6lr95KtI4Ih8H0qQMROE/quervWNxGuGiCcqSB6QMeIPPiu+zv4joxkFRbk IZKpGu+kIS04vf+xFJ/RnNOSmmcFN/NEdqLW3PHtOz2KbNbXgVVdzd79OIisdSENxb/A yu5A== X-Gm-Message-State: AOAM531ngfwvUlkmO4eNpecaL8mJN/gk959kLF0EI8bFdeBHsEkOPi9B OJlMnxXKuH5zTEe350kXz8vQTB1WYkRlW/6V X-Google-Smtp-Source: ABdhPJz+5QsKKesuuV9G4x9GScjiqw76ITJ3NJEG/lwyLT0vddJi3W5i/BAMQ/QkaBZXZ/SwBDfTTw== X-Received: by 2002:a17:902:8d87:b0:14f:7ad8:65c3 with SMTP id v7-20020a1709028d8700b0014f7ad865c3mr7926666plo.32.1645314207967; Sat, 19 Feb 2022 15:43:27 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id v17-20020a17090a459100b001b93ef45c13sm3057268pjg.55.2022.02.19.15.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 15:43:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson , Vladimir Medvedkin , Anatoly Burakov , Yipeng Wang , Sameh Gobriel , Olivier Matz , Andrew Rybchenko , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH 3/3] lpm: remove unnecessary NULL checks Date: Sat, 19 Feb 2022 15:43:22 -0800 Message-Id: <20220219234322.61309-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220219234322.61309-1-stephen@networkplumber.org> References: <20220219234322.61309-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() alread 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