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 2C164A04AD; Mon, 24 Jan 2022 18:54:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C6BD429D5; Mon, 24 Jan 2022 18:48:57 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 3DFA3429C0 for ; Mon, 24 Jan 2022 18:48:50 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id g9-20020a17090a67c900b001b4f1d71e4fso508352pjm.4 for ; Mon, 24 Jan 2022 09:48:50 -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=2VkdmQo5crYaOImBNKVhgCegi8tJOjt+WIV+jgQ4T9avbrhWwmGwfrm1MN5giTF7oj Q9Cw7uaeYYqZkk7ENNE/U13JAOLZQSwMR55OxkZVJy3LzejRvuVn7Bi5timRDme0EmL1 gfps76N+Jsyh095Xkpl4ZtS2ExpAeg7h/RJ1tNdzQy1Hqwb/7wxjHtuvQhhUu8OUUdS5 Zf/wC0H7DupBPfdjLJXotiqCc9roUskuM5aJK06LIe6cHH1/zqFNMxqNjktjEtsbi2QK nIfqAVylXT5gNpiWKo6ygvePJ9/fxKxUF2OfZFe6YFsYgUzUmuZ2bIFOlwXkl6CBNF/q owOw== 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=Sea2wMtZikISJ8LWHpMqKWIXfSZ6uvt7xs+SHJF/rYiiTkuwlvdvV+G3ilzFWIOYs8 7VqTT+mFrhLy2D8BzPqCXtzY1VxmIP9Tk1ou1ACUXS99Dx/YeL5q6vfqJlxU4O5qaFhX GqiLoIoUPFy6ov7zi4vh0pZX6Z9bB3VvRzE+0Yr3Qb6m4EFFgpHyDthTpczDwVIgxqCy U9jvpPiwfuBuIS0BMaK+YbSWxcfzJDsoUdxKMz3DvVCvK7sG9GuS2qXukX6LZThCUP73 u7eSEuq6ztQA9jHgqwTC3OnfFRknm0pztNWndrYQ9pO7LbcXtSLZD7EzCBP7xlPiCOA4 AnQw== X-Gm-Message-State: AOAM531jKeu1rV8YYUs/TPEvRWW1OQgkI0PjihOAVccs/WVLPaY3FuDC KrzJIKaIkqNoUa5kEBtqZyCWvzVHBrsofw== X-Google-Smtp-Source: ABdhPJxrdbS2/syqjTgYEUFt/yoAFnQPbJMC9y93LMAqbwjaYUEgafvwZZU6vWsHVJP6AWJh194OPA== X-Received: by 2002:a17:902:c213:b0:14a:f05e:278 with SMTP id 19-20020a170902c21300b0014af05e0278mr15463837pll.133.1643046529311; Mon, 24 Jan 2022 09:48:49 -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.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:48:48 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH v2 81/83] port: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:47:17 -0800 Message-Id: <20220124174719.14417-82-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 --- 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