From patchwork Sun Feb 20 18:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 107873 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F4135A00C2; Sun, 20 Feb 2022 19:22:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D356841151; Sun, 20 Feb 2022 19:21:56 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id 4338C41143 for ; Sun, 20 Feb 2022 19:21:55 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id qe15so12992034pjb.3 for ; Sun, 20 Feb 2022 10:21:55 -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=5HP/L6tCknZbohNLet2+FsxvgjfV2IN0s2HMuToTnb/1QKRV3OjkOmyZMXZcpBaZXj gvFBY2Mp7G09FBokmxFfOY4FHb2n9BanzgGqYqJK/3jEZbUnvObs/dMZctZxeDUVIBVk 8YYwngDCaAzj9ULvOFcrCoam/G/x3Sc5vvIsvNDGo1VwiW/xTtnnaTIAbSnFDVTffcCL CqkXkjVyJCAVY9DqwpXcnwmAPN1tJzIFrV1hyQ0febInN1ujPKzl6Cr3x983Wweoq4my NvcdsKw7QiE2XjaydDlPpKSykMg+TQrS3ga/vs7KczV070vVh29UfMayw1yjGCDJagbi YUoQ== 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=OQlo2O5+U82kiQNR8WZZVvE0YX+xkaJ9cFCb7stmPx3fjejkcXx+0hcwM7P3jZFar9 FeokQTtTNfw1mmoybH0zyVh39praQBhR0AKqxJIkFmQ7J8mv7doEvZI9dp4LcVa44i1D z3+eAK9E1q5SM7tfRCyn+IFetQ1RVqx17usAcDEafRupOYk9I2XpagbWLmFRz/z85i+r iSqkSkrfo/Wod4WeQpMD9F+9nsKgy5Xdt9iM3Huy68SJJPTbBCUN+ElbSYoQY3oA/EG4 Xc4LUP/Px5ucWmesGMcgevNkRRELalPcSnVEY4oD2VKg1oHtb/EIwAXk5N7hN7RY+ORm GiUg== X-Gm-Message-State: AOAM5339nch05KqhWBX9nI6N///Jd3JZQZUQIlhRu32mDFUIbiQ9X+oF 6mrMk5jSmPYfWHMvWDM1GtzU4QGJJZT+FvG5 X-Google-Smtp-Source: ABdhPJwV6HYA2DGyr+H/dM3fHw/tKkB/a0zsxnaKQodfdwRIJq7en3jX/0eigGQQY1lctad0UICFyQ== X-Received: by 2002:a17:90a:5402:b0:1b9:68e8:282e with SMTP id z2-20020a17090a540200b001b968e8282emr17730193pjh.62.1645381314089; Sun, 20 Feb 2022 10:21:54 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u8sm13528107pgf.83.2022.02.20.10.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 10:21:53 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson , Vladimir Medvedkin , Yipeng Wang , Sameh Gobriel , Anatoly Burakov , Olivier Matz , Andrew Rybchenko , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH v3 3/8] lpm: remove unnecessary NULL checks Date: Sun, 20 Feb 2022 10:21:42 -0800 Message-Id: <20220220182147.9750-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220220182147.9750-1-stephen@networkplumber.org> References: <20220219234322.61309-1-stephen@networkplumber.org> <20220220182147.9750-1-stephen@networkplumber.org> MIME-Version: 1.0 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 Reviewed-by: Ruifeng Wang Acked-by: Vladimir Medvedkin --- 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 */