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 C7E2FA0093; Thu, 10 Nov 2022 00:47:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21FFF42D15; Thu, 10 Nov 2022 00:47:01 +0100 (CET) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by mails.dpdk.org (Postfix) with ESMTP id D51A14114A for ; Thu, 10 Nov 2022 00:46:58 +0100 (CET) Received: by mail-pg1-f182.google.com with SMTP id h193so97749pgc.10 for ; Wed, 09 Nov 2022 15:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nmrm3b9OhvEkvfnTnYQjrjZdM1u7QDkj4LQSw7hPXdc=; b=59W/cEEqMZQISAFdeh6T2rYAoS7JliGloL+ZzIPYGi1QiKYugjWurl4vDPmovY/VZ0 XmBOjjBhYvrCnUbtU8r5DS10bzq/1GXLGgs7rnD/HV5hpSIgnFUqZve3ObO4KTsN0p2j K7DeKaWdElNvv/psMnucCMRrA6PxtzGvHBChbHA6VpYdnbvIQr25iBnRSMTqJJvIuzB8 sqQpWS6RyY+2fwExPYqftKtYZJqQVekvpiy5NHDMxR/io3s+cqv08vx4foJStXp/ijox ubsueNY4fEFZC60YwArsosycxZaB5BpeEdWwzhylc+oEVDnl7VwFjjKeb0LwmxIyXksq UnIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nmrm3b9OhvEkvfnTnYQjrjZdM1u7QDkj4LQSw7hPXdc=; b=wZJL5GByxb7upOg0x/yHgC/doAW69IFS35bQ6RnaMduI19VuX0ZrFuucHce6gwtTzF fUKuohtAAprn3pG/Tx7TwiFhyh7oIfoUUa3kmDJPvc/L8InIEVbu9ilWo9sdkvRnVGFs N3RhkvZaz/ANGLjAEZ0JwYDbofkaJaLBeZELbielKnK2+xHyrCAEZedfsANUL1MlktN5 54QubXglChm6eLwYVSK0D7rAW5AeEmW+zHXRs02oREB/5wKIQSQI8eX/aguAj7k2px6L oRvBGKOy85o+lodumfS2ekZuMIOpm2EN37EUbflPGwVH40b1Bhk+pB7lAJaJ1Ohqx+ka 4C+g== X-Gm-Message-State: ACrzQf2Hy6jSoh3JWiiWCjiSpQtPk/IE7jlNTIVH1kPRDNVROIRptrtN veBk4dKg033Wl8RiN1TokomR5qjazfIUeA== X-Google-Smtp-Source: AMsMyM5DBBQCPaqjHvpMhIPCrrmLaQiR0sBJ/3r9NQW83QebeTqehdp3fAoYT0LkLyVnpEay7STwBg== X-Received: by 2002:a05:6a00:848:b0:56e:4e85:33fc with SMTP id q8-20020a056a00084800b0056e4e8533fcmr35049081pfk.40.1668037617729; Wed, 09 Nov 2022 15:46:57 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id e18-20020a63e012000000b00470275c8d6dsm7895259pgh.10.2022.11.09.15.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 15:46:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Hunt , Brian Dooley Subject: [PATCH 4/4] examples: remove unnecessary null checks Date: Wed, 9 Nov 2022 15:46:49 -0800 Message-Id: <20221109234649.331942-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109234649.331942-1-stephen@networkplumber.org> References: <20221109234649.331942-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 function rte_free() already handles NULL argument; therefore the checks in this code are unnecessary. Signed-off-by: Stephen Hemminger --- examples/distributor/main.c | 3 +-- examples/fips_validation/main.c | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/distributor/main.c b/examples/distributor/main.c index e767973ed8de..21304d661873 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -1017,8 +1017,7 @@ main(int argc, char *argv[]) print_stats(); - if (pd) - rte_free(pd); + rte_free(pd); rte_free(pr); /* clean up the EAL */ diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 40a5b70e073b..73caaffb7e7a 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -962,8 +962,7 @@ prepare_rsa_op(void) asym->rsa.message.data = msg.val; asym->rsa.message.length = msg.len; - if (vec.rsa.signature.val) - rte_free(vec.rsa.signature.val); + rte_free(vec.rsa.signature.val); vec.rsa.signature.val = rte_zmalloc(NULL, vec.rsa.n.len, 0); vec.rsa.signature.len = vec.rsa.n.len; @@ -1011,11 +1010,9 @@ prepare_ecdsa_op(void) asym->ecdsa.k.data = vec.ecdsa.k.val; asym->ecdsa.k.length = vec.ecdsa.k.len; - if (vec.ecdsa.r.val) - rte_free(vec.ecdsa.r.val); + rte_free(vec.ecdsa.r.val); - if (vec.ecdsa.s.val) - rte_free(vec.ecdsa.s.val); + rte_free(vec.ecdsa.s.val); vec.ecdsa.r.len = info.interim_info.ecdsa_data.curve_len; vec.ecdsa.r.val = rte_zmalloc(NULL, vec.ecdsa.r.len, 0); @@ -1060,11 +1057,9 @@ prepare_ecfpm_op(void) asym->ecpm.scalar.data = vec.ecdsa.pkey.val; asym->ecpm.scalar.length = vec.ecdsa.pkey.len; - if (vec.ecdsa.qx.val) - rte_free(vec.ecdsa.qx.val); + rte_free(vec.ecdsa.qx.val); - if (vec.ecdsa.qy.val) - rte_free(vec.ecdsa.qy.val); + rte_free(vec.ecdsa.qy.val); vec.ecdsa.qx.len = info.interim_info.ecdsa_data.curve_len; vec.ecdsa.qx.val = rte_zmalloc(NULL, vec.ecdsa.qx.len, 0); -- 2.35.1