From 6307b909b8e01af6737734cde4ff8b782b6efdf3 Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Mon, 11 May 2015 17:10:25 +0300 Subject: [PATCH] lib: remove extra parenthesis after return Remove extra parenthesis from return statements. Signed-off-by: Ferruh Yigit --- lib/librte_cmdline/cmdline_parse_etheraddr.c | 10 ++--- lib/librte_cmdline/cmdline_parse_ipaddr.c | 38 +++++++++---------- lib/librte_cmdline/cmdline_parse_num.c | 24 ++++++------ lib/librte_cmdline/cmdline_parse_portlist.c | 14 +++---- lib/librte_cmdline/cmdline_socket.c | 2 +- lib/librte_eal/bsdapp/contigmem/contigmem.c | 22 +++++------ lib/librte_eal/bsdapp/eal/eal.c | 4 +- lib/librte_eal/bsdapp/eal/eal_pci.c | 12 +++--- lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 10 ++--- lib/librte_eal/common/eal_common_memzone.c | 2 +- lib/librte_eal/common/include/rte_common.h | 2 +- lib/librte_eal/common/include/rte_pci.h | 6 +-- lib/librte_eal/linuxapp/eal/eal.c | 4 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 4 +- lib/librte_eal/linuxapp/eal/eal_memory.c | 4 +- .../linuxapp/kni/ethtool/igb/igb_procfs.c | 2 +- lib/librte_eal/linuxapp/kni/kni_net.c | 8 ++-- lib/librte_ip_frag/ip_frag_internal.c | 12 +++--- lib/librte_ip_frag/rte_ip_frag_common.c | 6 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 ++-- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 8 ++-- lib/librte_lpm/rte_lpm.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 16 ++++---- lib/librte_mempool/rte_dom0_mempool.c | 2 +- lib/librte_mempool/rte_mempool.c | 18 ++++----- lib/librte_net/rte_ip.h | 2 +- 26 files changed, 121 insertions(+), 121 deletions(-) diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c index 64ae86c75b..dbfe4a6134 100644 --- a/lib/librte_cmdline/cmdline_parse_etheraddr.c +++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c @@ -105,32 +105,32 @@ my_ether_aton(const char *a) errno = 0; o[i] = strtoul(a, &end, 16); if (errno != 0 || end == a || (end[0] != ':' && end[0] != 0)) - return (NULL); + return NULL; a = end + 1; } while (++i != sizeof (o) / sizeof (o[0]) && end[0] != 0); /* Junk at the end of line */ if (end[0] != 0) - return (NULL); + return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ if (i == ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) - return (NULL); + return NULL; ether_addr.ea_oct[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ } else if (i == ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) - return (NULL); + return NULL; ether_addr.ea_oct[i * 2] = (uint8_t)(o[i] >> 8); ether_addr.ea_oct[i * 2 + 1] = (uint8_t)(o[i] & 0xff); } /* unknown format */ } else - return (NULL); + return NULL; return (struct ether_addr *)ðer_addr; } diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c index 7f33599423..d3d3e044a4 100644 --- a/lib/librte_cmdline/cmdline_parse_ipaddr.c +++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c @@ -135,12 +135,12 @@ my_inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: - return (inet_pton4(src, dst)); + return inet_pton4(src, dst); case AF_INET6: - return (inet_pton6(src, dst)); + return inet_pton6(src, dst); default: errno = EAFNOSUPPORT; - return (-1); + return -1; } /* NOTREACHED */ } @@ -172,26 +172,26 @@ inet_pton4(const char *src, unsigned char *dst) unsigned int new = *tp * 10 + (pch - digits); if (new > 255) - return (0); + return 0; if (! saw_digit) { if (++octets > 4) - return (0); + return 0; saw_digit = 1; } *tp = (unsigned char)new; } else if (ch == '.' && saw_digit) { if (octets == 4) - return (0); + return 0; *++tp = 0; saw_digit = 0; } else - return (0); + return 0; } if (octets < 4) - return (0); + return 0; memcpy(dst, tmp, INADDRSZ); - return (1); + return 1; } /* int @@ -224,7 +224,7 @@ inet_pton6(const char *src, unsigned char *dst) /* Leading :: requires some special handling. */ if (*src == ':') if (*++src != ':') - return (0); + return 0; curtok = src; saw_xdigit = count_xdigit = 0; val = 0; @@ -236,11 +236,11 @@ inet_pton6(const char *src, unsigned char *dst) pch = strchr((xdigits = xdigits_u), ch); if (pch != NULL) { if (count_xdigit >= 4) - return (0); + return 0; val <<= 4; val |= (pch - xdigits); if (val > 0xffff) - return (0); + return 0; saw_xdigit = 1; count_xdigit++; continue; @@ -249,14 +249,14 @@ inet_pton6(const char *src, unsigned char *dst) curtok = src; if (!saw_xdigit) { if (colonp) - return (0); + return 0; colonp = tp; continue; } else if (*src == '\0') { - return (0); + return 0; } if (tp + sizeof(int16_t) > endp) - return (0); + return 0; *tp++ = (unsigned char) ((val >> 8) & 0xff); *tp++ = (unsigned char) (val & 0xff); saw_xdigit = 0; @@ -272,11 +272,11 @@ inet_pton6(const char *src, unsigned char *dst) dbloct_count += 2; break; /* '\0' was seen by inet_pton4(). */ } - return (0); + return 0; } if (saw_xdigit) { if (tp + sizeof(int16_t) > endp) - return (0); + return 0; *tp++ = (unsigned char) ((val >> 8) & 0xff); *tp++ = (unsigned char) (val & 0xff); dbloct_count++; @@ -300,9 +300,9 @@ inet_pton6(const char *src, unsigned char *dst) tp = endp; } if (tp != endp) - return (0); + return 0; memcpy(dst, tmp, IN6ADDRSZ); - return (1); + return 1; } int diff --git a/lib/librte_cmdline/cmdline_parse_num.c b/lib/librte_cmdline/cmdline_parse_num.c index d8cf37f065..b0f9a35d6f 100644 --- a/lib/librte_cmdline/cmdline_parse_num.c +++ b/lib/librte_cmdline/cmdline_parse_num.c @@ -315,35 +315,35 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res, case BIN_OK: if ( nd.type == INT8 && res1 <= INT8_MAX ) { if (res) *(int8_t *)res = (int8_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT16 && res1 <= INT16_MAX ) { if (res) *(int16_t *)res = (int16_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT32 && res1 <= INT32_MAX ) { if (res) *(int32_t *)res = (int32_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT64 && res1 <= INT64_MAX ) { if (res) *(int64_t *)res = (int64_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == UINT8 && res1 <= UINT8_MAX ) { if (res) *(uint8_t *)res = (uint8_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if (nd.type == UINT16 && res1 <= UINT16_MAX ) { if (res) *(uint16_t *)res = (uint16_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == UINT32 && res1 <= UINT32_MAX ) { if (res) *(uint32_t *)res = (uint32_t) res1; - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == UINT64 ) { if (res) *(uint64_t *)res = res1; - return (buf-srcbuf); + return buf-srcbuf; } else { return -1; @@ -353,19 +353,19 @@ cmdline_parse_num(cmdline_parse_token_hdr_t *tk, const char *srcbuf, void *res, case DEC_NEG_OK: if ( nd.type == INT8 && res1 <= INT8_MAX + 1 ) { if (res) *(int8_t *)res = (int8_t) (-res1); - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT16 && res1 <= (uint16_t)INT16_MAX + 1 ) { if (res) *(int16_t *)res = (int16_t) (-res1); - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT32 && res1 <= (uint32_t)INT32_MAX + 1 ) { if (res) *(int32_t *)res = (int32_t) (-res1); - return (buf-srcbuf); + return buf-srcbuf; } else if ( nd.type == INT64 && res1 <= (uint64_t)INT64_MAX + 1 ) { if (res) *(int64_t *)res = (int64_t) (-res1); - return (buf-srcbuf); + return buf-srcbuf; } else { return -1; diff --git a/lib/librte_cmdline/cmdline_parse_portlist.c b/lib/librte_cmdline/cmdline_parse_portlist.c index 9c1fe3ea58..f11bdf0332 100644 --- a/lib/librte_cmdline/cmdline_parse_portlist.c +++ b/lib/librte_cmdline/cmdline_parse_portlist.c @@ -102,7 +102,7 @@ parse_ports(cmdline_portlist_t *pl, const char *str) ps = strtoul(first, &end, 10); if (errno != 0 || end == first || (end[0] != '-' && end[0] != 0 && end != last)) - return (-1); + return -1; /* Support for N-M portlist format */ if (end[0] == '-') { @@ -111,18 +111,18 @@ parse_ports(cmdline_portlist_t *pl, const char *str) pe = strtoul(first, &end, 10); if (errno != 0 || end == first || (end[0] != 0 && end != last)) - return (-1); + return -1; } else { pe = ps; } if (ps > pe || pe >= sizeof (pl->map) * 8) - return (-1); + return -1; parse_set_list(pl, ps, pe); } - return (0); + return 0; } int @@ -134,7 +134,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, cmdline_portlist_t *pl; if (!buf || ! *buf) - return (-1); + return -1; if (res && ressize < sizeof(cmdline_portlist_t)) return -1; @@ -146,7 +146,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, token_len++; if (token_len >= PORTLIST_TOKEN_SIZE) - return (-1); + return -1; snprintf(portlist_str, token_len+1, "%s", buf); @@ -155,7 +155,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, if (strcmp("all", portlist_str) == 0) pl->map = UINT32_MAX; else if (parse_ports(pl, portlist_str) != 0) - return (-1); + return -1; } return token_len; diff --git a/lib/librte_cmdline/cmdline_socket.c b/lib/librte_cmdline/cmdline_socket.c index 6820b6dfc5..3fc243b709 100644 --- a/lib/librte_cmdline/cmdline_socket.c +++ b/lib/librte_cmdline/cmdline_socket.c @@ -86,7 +86,7 @@ cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path) dprintf("open() failed\n"); return NULL; } - return (cmdline_new(ctx, prompt, fd, -1)); + return cmdline_new(ctx, prompt, fd, -1); } struct cmdline * diff --git a/lib/librte_eal/bsdapp/contigmem/contigmem.c b/lib/librte_eal/bsdapp/contigmem/contigmem.c index 8ac836d943..c6ca3b9ca2 100644 --- a/lib/librte_eal/bsdapp/contigmem/contigmem.c +++ b/lib/librte_eal/bsdapp/contigmem/contigmem.c @@ -99,7 +99,7 @@ static int contigmem_modevent(module_t mod, int type, void *arg) break; } - return (error); + return error; } moduledata_t contigmem_mod = { @@ -128,14 +128,14 @@ contigmem_load() if (contigmem_num_buffers > RTE_CONTIGMEM_MAX_NUM_BUFS) { printf("%d buffers requested is greater than %d allowed\n", contigmem_num_buffers, RTE_CONTIGMEM_MAX_NUM_BUFS); - return (EINVAL); + return EINVAL; } if (contigmem_buffer_size < PAGE_SIZE || (contigmem_buffer_size & (contigmem_buffer_size - 1)) != 0) { printf("buffer size 0x%lx is not greater than PAGE_SIZE and " "power of two\n", contigmem_buffer_size); - return (EINVAL); + return EINVAL; } for (i = 0; i < contigmem_num_buffers; i++) { @@ -145,7 +145,7 @@ contigmem_load() if (contigmem_buffers[i] == NULL) { printf("contigmalloc failed for buffer %d\n", i); - return (ENOMEM); + return ENOMEM; } printf("%2u: virt=%p phys=%p\n", i, contigmem_buffers[i], @@ -164,7 +164,7 @@ contigmem_load() contigmem_cdev = make_dev_credf(0, &contigmem_ops, 0, NULL, UID_ROOT, GID_WHEEL, 0600, "contigmem"); - return (0); + return 0; } static int @@ -183,7 +183,7 @@ contigmem_unload() contigfree(contigmem_buffers[i], contigmem_buffer_size, M_CONTIGMEM); - return (0); + return 0; } static int @@ -193,14 +193,14 @@ contigmem_physaddr(SYSCTL_HANDLER_ARGS) int index = (int)(uintptr_t)arg1; physaddr = (uint64_t)vtophys(contigmem_buffers[index]); - return (sysctl_handle_64(oidp, &physaddr, 0, req)); + return sysctl_handle_64(oidp, &physaddr, 0, req); } static int contigmem_open(struct cdev *cdev, int fflags, int devtype, struct thread *td) { - return (0); + return 0; } static int @@ -209,7 +209,7 @@ contigmem_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, { *paddr = offset; - return (0); + return 0; } static int @@ -222,11 +222,11 @@ contigmem_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, * app. */ if ((*offset/PAGE_SIZE) >= contigmem_num_buffers) - return (EINVAL); + return EINVAL; *offset = (vm_ooffset_t)vtophys(contigmem_buffers[*offset/PAGE_SIZE]); *obj = vm_pager_allocate(OBJT_DEVICE, cdev, size, nprot, *offset, curthread->td_ucred); - return (0); + return 0; } diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 5e25469eb2..4ee3ad23a9 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -593,11 +593,11 @@ rte_eal_init(int argc, char **argv) enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id) { - return (rte_config.lcore_role[lcore_id]); + return rte_config.lcore_role[lcore_id]; } enum rte_proc_type_t rte_eal_process_type(void) { - return (rte_config.process_type); + return rte_config.process_type; } diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index 61e89219b8..2df5c1cde7 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -179,10 +179,10 @@ pci_uio_map_secondary(struct rte_pci_device *dev) != uio_res->maps[i].addr) { RTE_LOG(ERR, EAL, "Cannot mmap device resource\n"); - return (-1); + return -1; } } - return (0); + return 0; } RTE_LOG(ERR, EAL, "Cannot find resource for device\n"); @@ -209,7 +209,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) /* secondary processes - use already recorded details */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return (pci_uio_map_secondary(dev)); + return pci_uio_map_secondary(dev); snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u", dev->addr.bus, dev->addr.devid, dev->addr.function); @@ -233,7 +233,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) if ((uio_res = rte_zmalloc("UIO_RES", sizeof (*uio_res), 0)) == NULL) { RTE_LOG(ERR, EAL, "%s(): cannot store uio mmap details\n", __func__); - return (-1); + return -1; } snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname); @@ -261,7 +261,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) (size_t)maps[j].size) ) == NULL) { rte_free(uio_res); - return (-1); + return -1; } maps[j].addr = mapaddr; @@ -271,7 +271,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) TAILQ_INSERT_TAIL(uio_res_list, uio_res, next); - return (0); + return 0; } /* Scan one pci sysfs entry, and fill the devices list from it. */ diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c index e649e325cb..720ceed156 100644 --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c @@ -131,7 +131,7 @@ nic_uio_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { *paddr = offset; - return (0); + return 0; } static int @@ -197,10 +197,10 @@ nic_uio_probe (device_t dev) pci_get_device(dev) == devices[i].dev) { device_set_desc(dev, "Intel(R) DPDK PCI Device"); - return (BUS_PROBE_SPECIFIC); + return BUS_PROBE_SPECIFIC; } - return (ENXIO); + return ENXIO; } static int @@ -305,7 +305,7 @@ nic_uio_unload(void) static int nic_uio_shutdown(void) { - return (0); + return 0; } static int @@ -326,5 +326,5 @@ nic_uio_modevent(module_t mod, int type, void *arg) break; } - return (0); + return 0; } diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c index 888f9e5bc4..aee184ac7e 100644 --- a/lib/librte_eal/common/eal_common_memzone.c +++ b/lib/librte_eal/common/eal_common_memzone.c @@ -120,7 +120,7 @@ align_phys_boundary(const struct rte_memseg *ms, size_t len, size_t align, addr_offset = start - ms->phys_addr; } - return (addr_offset); + return addr_offset; } static const struct rte_memzone * diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index c6e076b0f8..0ea1b499cb 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -291,7 +291,7 @@ rte_pause(void) {} static inline uint32_t rte_bsf32(uint32_t v) { - return (__builtin_ctz(v)); + return __builtin_ctz(v); } #ifndef offsetof diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index b4f38bcca3..7801fa0ab9 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -228,7 +228,7 @@ do { \ errno = 0; \ val = strtoul((in), &end, 16); \ if (errno != 0 || end[0] != (dlm) || val > (lim)) \ - return (-EINVAL); \ + return -EINVAL; \ (fd) = (typeof (fd))val; \ (in) = end + 1; \ } while(0) @@ -253,7 +253,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':'); GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.'); GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0); - return (0); + return 0; } /** @@ -275,7 +275,7 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr) GET_PCIADDR_FIELD(input, dev_addr->bus, UINT8_MAX, ':'); GET_PCIADDR_FIELD(input, dev_addr->devid, UINT8_MAX, '.'); GET_PCIADDR_FIELD(input, dev_addr->function, UINT8_MAX, 0); - return (0); + return 0; } #undef GET_PCIADDR_FIELD diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 926219b65d..8809f57b93 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -884,13 +884,13 @@ rte_eal_init(int argc, char **argv) enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id) { - return (rte_config.lcore_role[lcore_id]); + return rte_config.lcore_role[lcore_id]; } enum rte_proc_type_t rte_eal_process_type(void) { - return (rte_config.process_type); + return rte_config.process_type; } int rte_eal_has_hugepages(void) diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index a6325c68b5..b5f369ea1b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -505,7 +505,7 @@ rte_intr_callback_register(struct rte_intr_handle *intr_handle, if (write(intr_pipe.writefd, "1", 1) < 0) return -EPIPE; - return (ret); + return ret; } int @@ -569,7 +569,7 @@ rte_intr_callback_unregister(struct rte_intr_handle *intr_handle, ret = -EPIPE; } - return (ret); + return ret; } int diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 9b8d946730..341fefb17a 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -880,7 +880,7 @@ get_socket_mem_size(int socket) size += hpi->hugepage_sz * hpi->num_pages[socket]; } - return (size); + return size; } /* @@ -1341,7 +1341,7 @@ rte_eal_hugepage_init(void) "of memory.\n", i, nr_hugefiles, RTE_STR(CONFIG_RTE_MAX_MEMSEG), RTE_MAX_MEMSEG); - return (-ENOMEM); + return -ENOMEM; } return 0; diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_procfs.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_procfs.c index 4868202e72..66236d29e9 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_procfs.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_procfs.c @@ -262,7 +262,7 @@ int igb_procfs_topdir_init(void) { igb_top_dir = proc_mkdir("driver/igb", NULL); if (igb_top_dir == NULL) - return (-ENOMEM); + return -ENOMEM; return 0; } diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 5c9ca1923b..e34a0fdf4a 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -88,7 +88,7 @@ kni_net_open(struct net_device *dev) req.if_up = 1; ret = kni_net_process_request(kni, &req); - return (ret == 0 ? req.result : ret); + return (ret == 0) ? req.result : ret; } static int @@ -107,7 +107,7 @@ kni_net_release(struct net_device *dev) req.if_up = 0; ret = kni_net_process_request(kni, &req); - return (ret == 0 ? req.result : ret); + return (ret == 0) ? req.result : ret; } /* @@ -512,7 +512,7 @@ kni_net_change_mtu(struct net_device *dev, int new_mtu) if (ret == 0 && req.result == 0) dev->mtu = new_mtu; - return (ret == 0 ? req.result : ret); + return (ret == 0) ? req.result : ret; } /* @@ -598,7 +598,7 @@ kni_net_header(struct sk_buff *skb, struct net_device *dev, memcpy(eth->h_dest, daddr ? daddr : dev->dev_addr, dev->addr_len); eth->h_proto = htons(type); - return (dev->hard_header_len); + return dev->hard_header_len; } diff --git a/lib/librte_ip_frag/ip_frag_internal.c b/lib/librte_ip_frag/ip_frag_internal.c index a2c645bf87..3d36b7d3b0 100644 --- a/lib/librte_ip_frag/ip_frag_internal.c +++ b/lib/librte_ip_frag/ip_frag_internal.c @@ -200,7 +200,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr, ip_frag_key_invalidate(&fp->key); IP_FRAG_MBUF2DR(dr, mb); - return (NULL); + return NULL; } fp->frags[idx].ofs = ofs; @@ -211,7 +211,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr, /* not all fragments are collected yet. */ if (likely (fp->frag_size < fp->total_size)) { - return (mb); + return mb; /* if we collected all fragments, then try to reassemble. */ } else if (fp->frag_size == fp->total_size && @@ -259,7 +259,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr, /* we are done with that entry, invalidate it. */ ip_frag_key_invalidate(&fp->key); - return (mb); + return mb; } @@ -327,7 +327,7 @@ ip_frag_find(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, IP_FRAG_TBL_STAT_UPDATE(&tbl->stat, fail_total, (pkt == NULL)); tbl->last = pkt; - return (pkt); + return pkt; } struct ip_frag_pkt * @@ -347,7 +347,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl, assoc = tbl->bucket_entries; if (tbl->last != NULL && ip_frag_key_cmp(key, &tbl->last->key) == 0) - return (tbl->last); + return tbl->last; /* different hashing methods for IPv4 and IPv6 */ if (key->key_len == IPV4_KEYLEN) @@ -414,5 +414,5 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl, *free = empty; *stale = old; - return (NULL); + return NULL; } diff --git a/lib/librte_ip_frag/rte_ip_frag_common.c b/lib/librte_ip_frag/rte_ip_frag_common.c index c982d8cc7c..6176ff4e0a 100644 --- a/lib/librte_ip_frag/rte_ip_frag_common.c +++ b/lib/librte_ip_frag/rte_ip_frag_common.c @@ -83,7 +83,7 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, nb_entries > UINT32_MAX || nb_entries == 0 || nb_entries < max_entries) { RTE_LOG(ERR, USER1, "%s: invalid input parameter\n", __func__); - return (NULL); + return NULL; } sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]); @@ -92,7 +92,7 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, RTE_LOG(ERR, USER1, "%s: allocation of %zu bytes at socket %d failed do\n", __func__, sz, socket_id); - return (NULL); + return NULL; } RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n", @@ -106,7 +106,7 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries, tbl->entry_mask = (tbl->nb_entries - 1) & ~(tbl->bucket_entries - 1); TAILQ_INIT(&(tbl->lru)); - return (tbl); + return tbl; } /* dump frag table statistics to file */ diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 841ac14747..a52f549f7b 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -73,7 +73,7 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp) /* error - hole in the packet. */ if (m == prev) { - return (NULL); + return NULL; } } @@ -94,7 +94,7 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp) rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; - return (m); + return m; } /* @@ -151,7 +151,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, /* try to find/add entry into the fragment's table. */ if ((fp = ip_frag_find(tbl, dr, &key, tms)) == NULL) { IP_FRAG_MBUF2DR(dr, mb); - return (NULL); + return NULL; } IP_FRAG_LOG(DEBUG, "%s:%d:\n" @@ -178,5 +178,5 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, fp, fp->key.src_dst[0], fp->key.id, fp->start, fp->total_size, fp->frag_size, fp->last_idx); - return (mb); + return mb; } diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index 4ffcc7c655..0e32aa8b9d 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -123,7 +123,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) - return (-EINVAL); + return -EINVAL; in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); @@ -142,7 +142,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, out_pkt = rte_pktmbuf_alloc(pool_direct); if (unlikely(out_pkt == NULL)) { __free_fragments(pkts_out, out_pkt_pos); - return (-ENOMEM); + return -ENOMEM; } /* Reserve space for the IP header that will be built later */ @@ -160,7 +160,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, if (unlikely(out_seg == NULL)) { rte_pktmbuf_free(out_pkt); __free_fragments(pkts_out, out_pkt_pos); - return (-ENOMEM); + return -ENOMEM; } out_seg_prev->next = out_seg; out_seg_prev = out_seg; @@ -211,5 +211,5 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, out_pkt_pos ++; } - return (out_pkt_pos); + return out_pkt_pos; } diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 0c87a2919e..de053078d7 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -371,7 +371,7 @@ rule_find(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth) for (rule_index = rule_gindex; rule_index < last_rule; rule_index++) { /* If rule is found return the rule index. */ if (lpm->rules_tbl[rule_index].ip == ip_masked) - return (rule_index); + return rule_index; } /* If rule is not found return -EINVAL. */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 6c9cfd6cb0..eed481e222 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -552,7 +552,7 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp) m = (struct rte_mbuf *)mb; RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); rte_mbuf_refcnt_set(m, 1); - return (m); + return m; } /** @@ -648,7 +648,7 @@ void rte_ctrlmbuf_init(struct rte_mempool *mp, void *opaque_arg, static inline int rte_is_ctrlmbuf(struct rte_mbuf *m) { - return (!!(m->ol_flags & CTRL_MBUF_FLAG)); + return !!(m->ol_flags & CTRL_MBUF_FLAG); } /* Operations on pkt mbuf */ @@ -819,7 +819,7 @@ static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp) struct rte_mbuf *m; if ((m = __rte_mbuf_raw_alloc(mp)) != NULL) rte_pktmbuf_reset(m); - return (m); + return m; } /** @@ -919,9 +919,9 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) if (rte_mbuf_refcnt_update(md, -1) == 0) __rte_mbuf_raw_free(md); } - return(m); + return m; } - return (NULL); + return NULL; } /** @@ -989,7 +989,7 @@ static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md, uint8_t nseg; if (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL)) - return (NULL); + return NULL; mi = mc; prev = &mi->next; @@ -1011,11 +1011,11 @@ static inline struct rte_mbuf *rte_pktmbuf_clone(struct rte_mbuf *md, /* Allocation of new indirect segment failed */ if (unlikely (mi == NULL)) { rte_pktmbuf_free(mc); - return (NULL); + return NULL; } __rte_mbuf_sanity_check(mc, 1); - return (mc); + return mc; } /** diff --git a/lib/librte_mempool/rte_dom0_mempool.c b/lib/librte_mempool/rte_dom0_mempool.c index 3a15d7843b..0d6d7504ff 100644 --- a/lib/librte_mempool/rte_dom0_mempool.c +++ b/lib/librte_mempool/rte_dom0_mempool.c @@ -129,5 +129,5 @@ rte_dom0_mempool_create(const char *name, unsigned elt_num, unsigned elt_size, free(pa); - return (mp); + return mp; } diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index f592dc7564..3cd5aab1a2 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -208,7 +208,7 @@ rte_mempool_obj_iter(void *vaddr, uint32_t elt_num, size_t elt_sz, size_t align, } } - return (i); + return i; } /* @@ -317,7 +317,7 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags, /* this is the size of an object, including header and trailer */ sz->total_size = sz->header_size + sz->elt_size + sz->trailer_size; - return (sz->total_size); + return sz->total_size; } @@ -338,7 +338,7 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz, uint32_t pg_shift) sz = RTE_ALIGN_CEIL(elt_sz, pg_sz) * elt_num; } - return (sz); + return sz; } /* @@ -367,12 +367,12 @@ rte_mempool_xmem_usage(void *vaddr, uint32_t elt_num, size_t elt_sz, if ((n = rte_mempool_obj_iter(vaddr, elt_num, elt_sz, 1, paddr, pg_num, pg_shift, mempool_lelem_iter, &uv)) != elt_num) { - return (-(ssize_t)n); + return -(ssize_t)n; } uv = RTE_ALIGN_CEIL(uv, pg_sz); usz = uv - va; - return (usz); + return usz; } /* create the mempool */ @@ -384,18 +384,18 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size, int socket_id, unsigned flags) { #ifdef RTE_LIBRTE_XEN_DOM0 - return (rte_dom0_mempool_create(name, n, elt_size, + return rte_dom0_mempool_create(name, n, elt_size, cache_size, private_data_size, mp_init, mp_init_arg, obj_init, obj_init_arg, - socket_id, flags)); + socket_id, flags); #else - return (rte_mempool_xmem_create(name, n, elt_size, + return rte_mempool_xmem_create(name, n, elt_size, cache_size, private_data_size, mp_init, mp_init_arg, obj_init, obj_init_arg, socket_id, flags, - NULL, NULL, MEMPOOL_PG_NUM_DEFAULT, MEMPOOL_PG_SHIFT_MAX)); + NULL, NULL, MEMPOOL_PG_NUM_DEFAULT, MEMPOOL_PG_SHIFT_MAX); #endif } diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index cdbce20d69..71c519a121 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -243,7 +243,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) { uint16_t cksum; cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); - return ((cksum == 0xffff) ? cksum : ~cksum); + return (cksum == 0xffff) ? cksum : ~cksum; } /** -- 2.20.1