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 BAC82A04AD; Mon, 24 Jan 2022 18:47:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83561427F6; Mon, 24 Jan 2022 18:47:31 +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 169D1427E0 for ; Mon, 24 Jan 2022 18:47:28 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso13901575pjv.1 for ; Mon, 24 Jan 2022 09:47: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=ZF5DH4WTjbSkV2F/G0r3/VYP0G2BxRN5oK/2+qTsXtY=; b=6HJoY24Bb03niKDU2vTtdgVwTW+2lg66eYbh8DzeIkolCr0vhqR0hQKc5v+txv9Dqh Es/kSms9Ysa1ENs7hV54dp6+Eky6Kb5XyeUt6wPckiF0BHT0sHn3K1YToY4S+GZgHKBj uWraOqwHqqjXxAFkY9OZypPoK1WMSMnMJ3rVqF/vNupqjq/5gYe3MZxXftbgcpGkcScT 1EJIpz5WPo3YTfBed3BFqLVbXeFJwqqF/mZghi/W97fcn4Joe+rD4KTw0Rs7B/o5knkh vhWHrYEylegMLkiJoKVtMNmJI8555gmGGR/VerBDjWBf+bWTYQrHGlFRbp7oGOJoK8E0 wwwA== 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=yF8K0MRfYBHASsBd9EMPgEmtjViYNxpspALyl8gvBzbkqXwsmUrYl2mfuORkxRNhUr i5v3MguHCFGT2VOsij2kw3OrSgw89DIlraevGhNgsULmsOtkav/aU0jcnUa203Axz9WR ha255nJ6E2kR+eM0FfKVCE5WZ6Q1m/MjVnHQCGpRHa+4issooo8subG/rstd8qD7Fq1X ylV1nWVQNKFleD9i+ylz/rVILijr05dNI0CMXJt9gP+7QX3Bk4PS3T6UZkvoUst21M+l fJVoimLiWFO1QkmCnRK8XcErmwbxbHHDnaB0U8vysecSpJciNmqHTjYTiefL4iDOxtU+ c64A== X-Gm-Message-State: AOAM530XBPIO60qrxP65a1eZ9ipeuRST0kYIyBiCoPc4Lm3imN6NIkBF nMf7tbM7iDK0RozGIhurVllj9PV+49vY9A== X-Google-Smtp-Source: ABdhPJw6Gy6n9sfkyqrmHauB0Io0HvZBzmE1T+Z4jsfrWn7huuhIqqevyxlrtNrQ3Gtztd0g5zuncA== X-Received: by 2002:a17:90a:5d8d:: with SMTP id t13mr2987749pji.47.1643046447028; Mon, 24 Jan 2022 09:47:27 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q7sm15835082pfs.37.2022.01.24.09.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:47:26 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Marko Kovacevic Subject: [PATCH v2 05/83] examples/fips_validation: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:46:01 -0800 Message-Id: <20220124174719.14417-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124174719.14417-1-stephen@networkplumber.org> References: <20220124000518.319850-1-stephen@networkplumber.org> <20220124174719.14417-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