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 261D0A04AD; Mon, 24 Jan 2022 18:48:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C484D42839; Mon, 24 Jan 2022 18:47:40 +0100 (CET) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mails.dpdk.org (Postfix) with ESMTP id 2E3DF427EB for ; Mon, 24 Jan 2022 18:47:38 +0100 (CET) Received: by mail-pl1-f175.google.com with SMTP id d7so16298004plr.12 for ; Mon, 24 Jan 2022 09:47:38 -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=m5u8SZbeHnKwO+LR0Tf92LX8t/vOCtPZna+YbxalHH8=; b=07YaDAlIObgqceWisJFV7mkTrQKINu8PZZTcYWbJLoPyAcZ9awsqI0gDZqW8gEdRVl hXyeppY9C9Aggg+SUc4wv83w+w6+slsAr637/AccIveoX9+hTtOkt/bnGonlq8SLC67d GaBSuYxLGrU6WjD6aAcKXVg4B7oZQUzJP2QM+jHNK9a3WlC6HJdsCKU36Kdss7X+ff55 ntXe9whWbpesdOFGC+vIt5hmpW7sWduUPR0fH0DokL2HUaRfhbE0icOIWLxoIa/r55vb cuaqcgoqg7h6A8T6Dn3JPYz5jch/UVnvV0ZfPE3QvEhKnrjqCZNDRVN+/FWJC2el9+dJ WxVQ== 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=m5u8SZbeHnKwO+LR0Tf92LX8t/vOCtPZna+YbxalHH8=; b=i+wuebyY35tZbG8gvJUooBu7X28haFaU/sP2dOTAkMVCzQ1iaVHfrFZ4C81j6QwBI2 wjSm580p6V/Md+qSyQR79ZkU/5ICA/wYTPFr+XdNICzn4l8zcLzlQr6eSjCXXGJ7NMCL 99eEi+DKGDxp0aEzV8pfjaYOLZSDN2kRX2Vh4LexDOjmw2fhn1KK0SeA0hL1S00L+vXC O7x9C7Clyp6Q91G0XQJi3uK5KD83FydAUfB22KOY4QGAKK5hb1NFWxfB2eZuUhn4svUb 5DJjbT2IHfYv20Gq/xbCLTkc6c0Culrkto2unWwhzbhR5RfZtftLgCKBek2XJYP3fGHn mBHA== X-Gm-Message-State: AOAM533tz2qWcf6+JnhYBFsp/QkpNUnF/7sPZaepS/CVrUI1oroQC3v9 0sjbLxMzbi8lfL20pDguNjiInqbzTBrBSg== X-Google-Smtp-Source: ABdhPJyc4kuG3yOnPeA/0dvE49XwTL7F02CaKfyO5ONAd2duqCGGK2K7Qv0+BXG3oVi/umhmU+DJEQ== X-Received: by 2002:a17:90b:4f84:: with SMTP id qe4mr2998441pjb.24.1643046457096; Mon, 24 Jan 2022 09:47:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:47:36 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ori Kam Subject: [PATCH v2 14/83] app/test-regex: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:46:10 -0800 Message-Id: <20220124174719.14417-15-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 --- app/test-regex/main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/test-regex/main.c b/app/test-regex/main.c index 8e665df73ce0..ab8a3e56e774 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -210,8 +210,7 @@ read_file(char *file, char **buf) printf("Error, can't open file %s\n, err = %d", file, res); if (fp) fclose(fp); - if (*buf) - rte_free(*buf); + rte_free(*buf); return -res; } @@ -299,8 +298,7 @@ init_port(uint16_t *nb_max_payload, char *rules_file, uint8_t *nb_max_matches, rte_free(rules); return 0; error: - if (rules) - rte_free(rules); + rte_free(rules); return res; } @@ -367,8 +365,7 @@ regex_create_segmented_mbuf(struct rte_mempool *mbuf_pool, int pkt_len, return mbuf; fail: - if (mbuf) - rte_pktmbuf_free(mbuf); + rte_pktmbuf_free(mbuf); return NULL; } @@ -612,8 +609,7 @@ run_regex(void *args) rte_free(qp->buf); qp->buf = NULL; } - if (mbuf_mp) - rte_mempool_free(mbuf_mp); + rte_mempool_free(mbuf_mp); rte_free(qps); return res; } -- 2.30.2