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 C8130A04A6; Mon, 24 Jan 2022 01:05:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 562D9427CA; Mon, 24 Jan 2022 01:05:29 +0100 (CET) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id 8DFAB427BB for ; Mon, 24 Jan 2022 01:05:26 +0100 (CET) Received: by mail-pg1-f179.google.com with SMTP id h23so13608942pgk.11 for ; Sun, 23 Jan 2022 16:05:26 -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=ZF5DH4WTjbSkV2F/G0r3/VYP0G2BxRN5oK/2+qTsXtY=; b=hM2xwqPqbzCTds31CbfEiY7MmhoPr5GFnbPlqRhzY9QFIybSZcEL5kppES+N9UGSsk eezrrSRq2zeadmNMwT9y9fRnfLXnchUt35q8SotJzmIzoxy9ZVGndwz8fKu39DwzAPRp Gz4MczYrjJQKtK5sRG9Pc40O/jzIrBzGJwWOZtts0UAAMMeZWOzWsPUy7W2U6AHW1Nl0 stPZ6lBMyeJzeaVva9v2j7N7ySgWHTZQWjKvexOBZ0izfhZl7ULVsq7Bnkqz4hk15IVl oAEOPqZEIRjlbNCySJBd6UY4Fh1HAx8ogxpoy0Kj52D9eTCnn2r0fkKCBTbRjL/DkSAl 7snA== 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=ZF5DH4WTjbSkV2F/G0r3/VYP0G2BxRN5oK/2+qTsXtY=; b=XNpktKzDyEhPIB/LUu6uXnRPiPYsLJg398ZbbZuR0o8l8/AXXOGgNNn0gN3JveJAAd YgKBz/8AHBYow74bBy7hLYyfjufw4dpyo+qXF5wvzRyw1tMYfZh0XhU5zcyk+KQvJj1g g/nnqDUS95nLMVR2LAPjTvVzcipzcroSSKstL7juo2WLu13bL7Uq0JfcyOxRDAEd3M1d C20kJFQvU84QI0SghueoFXrZ1/piRU49W7byuulpJYr78/HIWlKrUSehXHqdoU6pnWwC vFdLKV8hiyF8dzvbgbt07hvGyHwFozT2zlM89AU25zG7M6pONurzI+Oh3bfmgM8edjQR ++Wg== X-Gm-Message-State: AOAM532L02FwEhYSe8NhB04RVeCqyoWG+iPwILK2h9ORR+YnjZNQsjP3 qdYHPirrh4Lrt7Q1BabgHVo027EPBtd9iA== X-Google-Smtp-Source: ABdhPJyce6WDf4mN1HhEjlt41XnYA8ehGtF2tsd66iiBCNOaWXkQMYnHarneD3AObrzUfH4aFthkUg== X-Received: by 2002:a63:b30b:: with SMTP id i11mr10106746pgf.457.1642982725566; Sun, 23 Jan 2022 16:05:25 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id ck21sm10935350pjb.51.2022.01.23.16.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 16:05:25 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Marko Kovacevic Subject: [PATCH 04/82] examples/fips_validation: remove unnecessary NULL checks Date: Sun, 23 Jan 2022 16:04:00 -0800 Message-Id: <20220124000518.319850-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124000518.319850-1-stephen@networkplumber.org> References: <20220124000518.319850-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 Remove redundant NULL pointer checks before free functions found by nullfree.cocci Signed-off-by: Stephen Hemminger --- examples/fips_validation/fips_dev_self_test.c | 18 ++++------ examples/fips_validation/fips_validation.c | 3 +- examples/fips_validation/main.c | 36 +++++++------------ 3 files changed, 19 insertions(+), 38 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index b4eab05a9851..076e9de099c0 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -1396,8 +1396,7 @@ check_aead_result(struct rte_crypto_op *op, if (!mbuf) return -1; - if (op->sym->aead.aad.data) - rte_free(op->sym->aead.aad.data); + rte_free(op->sym->aead.aad.data); if (dir == self_test_dir_enc_auth_gen) { src = vec->output.data; @@ -1523,18 +1522,13 @@ static void fips_dev_auto_test_uninit(uint8_t dev_id, struct fips_dev_auto_test_env *env) { - if (env->mbuf) - rte_pktmbuf_free(env->mbuf); + rte_pktmbuf_free(env->mbuf); if (env->op) rte_crypto_op_free(env->op); - if (env->mpool) - rte_mempool_free(env->mpool); - if (env->op_pool) - rte_mempool_free(env->op_pool); - if (env->sess_pool) - rte_mempool_free(env->sess_pool); - if (env->sess_priv_pool) - rte_mempool_free(env->sess_priv_pool); + rte_mempool_free(env->mpool); + rte_mempool_free(env->op_pool); + rte_mempool_free(env->sess_pool); + rte_mempool_free(env->sess_priv_pool); rte_cryptodev_stop(dev_id); } diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 52a7bf952d46..94253eaee8bf 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -344,8 +344,7 @@ fips_test_clear(void) fclose(info.fp_rd); if (info.fp_wr) fclose(info.fp_wr); - if (info.one_line_text) - free(info.one_line_text); + free(info.one_line_text); if (info.nb_vec_lines) { uint32_t i; diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index dc40bffe7d97..e06ae37567fd 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -143,12 +143,9 @@ cryptodev_fips_validate_app_int(void) error_exit: rte_mempool_free(env.mpool); - if (env.sess_mpool) - rte_mempool_free(env.sess_mpool); - if (env.sess_priv_mpool) - rte_mempool_free(env.sess_priv_mpool); - if (env.op_pool) - rte_mempool_free(env.op_pool); + rte_mempool_free(env.sess_mpool); + rte_mempool_free(env.sess_priv_mpool); + rte_mempool_free(env.op_pool); return ret; } @@ -523,8 +520,7 @@ prepare_data_mbufs(struct fips_val *val) uint16_t nb_seg; int ret = 0; - if (env.mbuf) - rte_pktmbuf_free(env.mbuf); + rte_pktmbuf_free(env.mbuf); if (total_len > RTE_MBUF_MAX_NB_SEGS) { RTE_LOG(ERR, USER1, "Data len %u too big\n", total_len); @@ -598,8 +594,7 @@ prepare_data_mbufs(struct fips_val *val) return 0; error_exit: - if (head) - rte_pktmbuf_free(head); + rte_pktmbuf_free(head); return ret; } @@ -656,8 +651,7 @@ prepare_auth_op(void) if (ret < 0) return ret; - if (env.digest) - rte_free(env.digest); + rte_free(env.digest); env.digest = rte_zmalloc(NULL, vec.cipher_auth.digest.len, RTE_CACHE_LINE_SIZE); @@ -705,8 +699,7 @@ prepare_aead_op(void) if (ret < 0) return ret; - if (env.digest) - rte_free(env.digest); + rte_free(env.digest); env.digest = rte_zmalloc(NULL, vec.aead.digest.len, RTE_CACHE_LINE_SIZE); if (!env.digest) { @@ -1430,8 +1423,7 @@ fips_mct_tdes_test(void) } } - if (val.val) - free(val.val); + free(val.val); return 0; } @@ -1510,8 +1502,7 @@ fips_mct_aes_ecb_test(void) } } - if (val.val) - free(val.val); + free(val.val); return 0; } @@ -1619,8 +1610,7 @@ fips_mct_aes_test(void) memcpy(vec.iv.val, val.val, AES_BLOCK_SIZE); } - if (val.val) - free(val.val); + free(val.val); return 0; } @@ -1706,8 +1696,7 @@ fips_mct_sha_test(void) rte_free(vec.pt.val); - if (val.val) - free(val.val); + free(val.val); return 0; } @@ -1851,8 +1840,7 @@ fips_test_one_file(void) rte_free(env.digest); env.digest = NULL; } - if (env.mbuf) - rte_pktmbuf_free(env.mbuf); + rte_pktmbuf_free(env.mbuf); return ret; } -- 2.30.2