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 BDB66A04A6; Mon, 24 Jan 2022 01:12:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D971D42968; Mon, 24 Jan 2022 01:06:49 +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 3B80942953 for ; Mon, 24 Jan 2022 01:06:46 +0100 (CET) Received: by mail-pl1-f175.google.com with SMTP id d7so13905149plr.12 for ; Sun, 23 Jan 2022 16:06:46 -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=su+2iWKTkbFtsNLGM+VLfZiV8t8YMaoSIC5oWYs3dcg=; b=s0ticvjFqYCwnXaVJWO/fT0bx2W4Cci40EBZJmll8paB1rPOoC7HfJkinbD6Dt9KAx xwTClQTLINCKiiVhIlEgV6tmjceZ0BoeYV7IwCHmrMZGKc+jVTp7nQ1psH/EtF47e1HU jvezDYO3k0SOcleWvDqvtNhBKdPoLvbeSsuYLs++HW3VenFV5P2EsSOVt+WtEVcX3i+x 6RcJ17lc1zEpdf2/169Nysy/vxM9kkQO8OpHVmI63Wn5LeQsPmBpfaDD/GAT+Vx1BJd4 U3nqf+2F800OGNjpZOPzKErpeAb2JAwCcH9mlTk6mxpxF4BkiwumBzX7AFlK3bRlC6D/ lCQQ== 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=su+2iWKTkbFtsNLGM+VLfZiV8t8YMaoSIC5oWYs3dcg=; b=vtAHeJVLV6x/39eOFO5cUigpI2qv5883RBYS2GQ/B3Gwxj2elZEh/4jiWF57MbcnmP 4YL8lv+6RJJTduhYlVq4oBa4OH5NuaKwglsg+ynkgqQtmmBpxkFkVuYVT5eaLzSXYA8Q WZ/UZ1HmVqwq2zNl6zn8JLJMHo9JspHp7KhcJOg2OLs7opw0/kyVZRnzu49vfcjnaPe5 s+laNI6XGsA9M7dYUPlKIidiPIbqrmsbI6IXQV6LjfMSBo5xCTOkHODavkLBYb6tLvWs WcuHTf8LvxtXTCkNgPn25XAk49ur2PKY+DeAYWY2lxu50iZ0cP187eFYaNVidtw2lHVW P3eg== X-Gm-Message-State: AOAM533krn3LGvriLRh3giEYgUZoYaMNg9WNRpP/IJMjsmOP8Yn2a4EP roKXldCjUH6e8dtgLJbEQdhx0NJslEPByQ== X-Google-Smtp-Source: ABdhPJxGpdvt6Ef6pj216pz2V3JYF+IRegylYMSNbBfb1aQq/nctayLQ6pnCl9L+qSbSqN9vcRNjQQ== X-Received: by 2002:a17:90a:5e0d:: with SMTP id w13mr10523007pjf.235.1642982804965; Sun, 23 Jan 2022 16:06:44 -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.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 16:06:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH 80/82] port: remove unnecessary NULL checks Date: Sun, 23 Jan 2022 16:05:16 -0800 Message-Id: <20220124000518.319850-81-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 --- lib/port/rte_port_source_sink.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c index 68575c98338d..79042d13ff66 100644 --- a/lib/port/rte_port_source_sink.c +++ b/lib/port/rte_port_source_sink.c @@ -163,14 +163,10 @@ pcap_source_load(struct rte_port_source *port, return 0; error_exit: - if (pkt_len_aligns) - rte_free(pkt_len_aligns); - if (port->pkt_len) - rte_free(port->pkt_len); - if (port->pkts) - rte_free(port->pkts); - if (port->pkt_buff) - rte_free(port->pkt_buff); + rte_free(pkt_len_aligns); + rte_free(port->pkt_len); + rte_free(port->pkts); + rte_free(port->pkt_buff); return -1; } @@ -242,12 +238,9 @@ rte_port_source_free(void *port) if (p == NULL) return 0; - if (p->pkt_len) - rte_free(p->pkt_len); - if (p->pkts) - rte_free(p->pkts); - if (p->pkt_buff) - rte_free(p->pkt_buff); + rte_free(p->pkt_len); + rte_free(p->pkts); + rte_free(p->pkt_buff); rte_free(p); -- 2.30.2