DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/6] test: remove useless check of NULL before rte_free
Date: Tue,  7 Apr 2015 14:20:59 -0700	[thread overview]
Message-ID: <1428441663-3825-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1428441663-3825-1-git-send-email-stephen@networkplumber.org>

rte_free like Glibc free allows rte_free(NULL) as null operation.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_hash_perf.c |  2 +-
 app/test/virtual_pmd.c    | 18 ++++++------------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c
index bd531ec..6eabb21 100644
--- a/app/test/test_hash_perf.c
+++ b/app/test/test_hash_perf.c
@@ -387,7 +387,7 @@ struct tbl_perf_test_params tbl_perf_params[] =
 	if (cond) {							\
 		printf("ERROR line %d: " str "\n", __LINE__, ##__VA_ARGS__); \
 		if (handle) rte_fbk_hash_free(handle);			\
-		if (keys) rte_free(keys);				\
+		rte_free(keys);						\
 		return -1;						\
 	}								\
 } while(0)
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index 39ecf80..1f4da96 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -635,18 +635,12 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
 	return eth_dev->data->port_id;
 
 err:
-	if (pci_dev)
-		rte_free(pci_dev);
-	if (pci_drv)
-		rte_free(pci_drv);
-	if (eth_drv)
-		rte_free(eth_drv);
-	if (dev_ops)
-		rte_free(dev_ops);
-	if (id_table)
-		rte_free(id_table);
-	if (dev_private)
-		rte_free(dev_private);
+	rte_free(pci_dev);
+	rte_free(pci_drv);
+	rte_free(eth_drv);
+	rte_free(dev_ops);
+	rte_free(id_table);
+	rte_free(dev_private);
 
 	return -1;
 }
-- 
2.1.4

  reply	other threads:[~2015-04-07 21:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 21:20 [dpdk-dev] [PATCH v2 1/6] test: remove useless memset Stephen Hemminger
2015-04-07 21:20 ` Stephen Hemminger [this message]
2015-04-07 21:21 ` [dpdk-dev] [PATCH v2 3/6] examples: get rid of unneeded null checks before rte_free Stephen Hemminger
2015-04-07 21:21 ` [dpdk-dev] [PATCH v2 4/6] pmd: remove unnecessary if() " Stephen Hemminger
2015-04-07 21:21 ` [dpdk-dev] [PATCH v2 5/6] test: put dev_ops in private Stephen Hemminger
2015-04-07 21:21 ` [dpdk-dev] [PATCH v2 6/6] eth: make dev_ops const Stephen Hemminger
2015-04-08 11:49 ` [dpdk-dev] [PATCH v2 1/6] test: remove useless memset Neil Horman
2015-04-13 20:36   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428441663-3825-2-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).