app/test: remove useless null check before rte_free
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 7 Apr 2015 21:20:59 +0000 (14:20 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 13 Apr 2015 20:50:09 +0000 (22:50 +0200)
rte_free like Glibc free allows rte_free(NULL) as null operation.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
app/test/test_hash_perf.c
app/test/virtual_pmd.c

index bd531ec..6eabb21 100644 (file)
@@ -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)
index 39ecf80..1f4da96 100644 (file)
@@ -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;
 }