* [dpdk-dev] [PATCH 0/2] minor cleanups
@ 2016-12-08 1:47 Stephen Hemminger
2016-12-08 1:47 ` [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Stephen Hemminger @ 2016-12-08 1:47 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Saw this while reviewing other changes
Stephen Hemminger (2):
eth: get rid of goto's in rte_eth_dev_detach
sched/malloc: remove unnecesary return statements
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
lib/librte_eal/common/rte_malloc.c | 1 -
lib/librte_ether/rte_ethdev.c | 21 +++++++--------------
lib/librte_sched/rte_bitmap.h | 2 --
4 files changed, 8 insertions(+), 18 deletions(-)
--
2.10.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
2016-12-08 1:47 [dpdk-dev] [PATCH 0/2] minor cleanups Stephen Hemminger
@ 2016-12-08 1:47 ` Stephen Hemminger
2016-12-08 10:25 ` Ferruh Yigit
2016-12-08 1:47 ` [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements Stephen Hemminger
2017-01-09 17:09 ` [dpdk-dev] [PATCH 0/2] minor cleanups Thomas Monjalon
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2016-12-08 1:47 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Extra goto's to just a return are unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_ether/rte_ethdev.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4209ad0..40c7cc6 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -466,27 +466,20 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
int
rte_eth_dev_detach(uint8_t port_id, char *name)
{
- int ret = -1;
+ int ret;
- if (name == NULL) {
- ret = -EINVAL;
- goto err;
- }
+ if (name == NULL)
+ return -EINVAL;
/* FIXME: move this to eal, once device flags are relocated there */
- if (rte_eth_dev_is_detachable(port_id))
- goto err;
+ ret = rte_eth_dev_is_detachable(port_id);
+ if (ret < 0)
+ return ret;
snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
"%s", rte_eth_devices[port_id].data->name);
- ret = rte_eal_dev_detach(name);
- if (ret < 0)
- goto err;
- return 0;
-
-err:
- return ret;
+ return rte_eal_dev_detach(name);
}
static int
--
2.10.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements
2016-12-08 1:47 [dpdk-dev] [PATCH 0/2] minor cleanups Stephen Hemminger
2016-12-08 1:47 ` [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Stephen Hemminger
@ 2016-12-08 1:47 ` Stephen Hemminger
2016-12-08 10:33 ` Ferruh Yigit
2017-01-09 17:09 ` [dpdk-dev] [PATCH 0/2] minor cleanups Thomas Monjalon
2 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2016-12-08 1:47 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
return statements at end of void functions are unnecessary and unwanted.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
lib/librte_eal/common/rte_malloc.c | 1 -
lib/librte_sched/rte_bitmap.h | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a80b6fa..05afcee 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -241,8 +241,8 @@ arp_op_name(uint16_t arp_op, char *buf)
default:
break;
}
+
snprintf(buf, sizeof("Unknown"), "%s", "Unknown");
- return;
}
#endif
#define MaxIPv4String 16
diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index f4a8835..09970b0 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -232,7 +232,6 @@ rte_malloc_dump_stats(FILE *f, __rte_unused const char *type)
fprintf(f, "\tAlloc_count:%u,\n",sock_stats.alloc_count);
fprintf(f, "\tFree_count:%u,\n", sock_stats.free_count);
}
- return;
}
/*
diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
index 010d752..d432fdf 100644
--- a/lib/librte_sched/rte_bitmap.h
+++ b/lib/librte_sched/rte_bitmap.h
@@ -453,8 +453,6 @@ rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos)
offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK;
slab1 = bmp->array1 + index1;
*slab1 &= ~(1lu << offset1);
-
- return;
}
static inline int
--
2.10.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
2016-12-08 1:47 ` [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Stephen Hemminger
@ 2016-12-08 10:25 ` Ferruh Yigit
2016-12-22 10:33 ` Thomas Monjalon
0 siblings, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2016-12-08 10:25 UTC (permalink / raw)
To: Stephen Hemminger, dev
On 12/8/2016 1:47 AM, Stephen Hemminger wrote:
> Extra goto's to just a return are unnecessary.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> lib/librte_ether/rte_ethdev.c | 21 +++++++--------------
> 1 file changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 4209ad0..40c7cc6 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -466,27 +466,20 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
> int
> rte_eth_dev_detach(uint8_t port_id, char *name)
> {
> - int ret = -1;
> + int ret;
>
> - if (name == NULL) {
> - ret = -EINVAL;
> - goto err;
> - }
> + if (name == NULL)
> + return -EINVAL;
>
> /* FIXME: move this to eal, once device flags are relocated there */
> - if (rte_eth_dev_is_detachable(port_id))
> - goto err;
> + ret = rte_eth_dev_is_detachable(port_id);
> + if (ret < 0)
rte_eth_dev_is_detachable() can return 1 to indicate device is not
detachable.
> + return ret;
>
> snprintf(name, sizeof(rte_eth_devices[port_id].data->name),
> "%s", rte_eth_devices[port_id].data->name);
> - ret = rte_eal_dev_detach(name);
> - if (ret < 0)
> - goto err;
>
> - return 0;
> -
> -err:
> - return ret;
> + return rte_eal_dev_detach(name);
> }
>
> static int
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements
2016-12-08 1:47 ` [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements Stephen Hemminger
@ 2016-12-08 10:33 ` Ferruh Yigit
0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2016-12-08 10:33 UTC (permalink / raw)
To: Stephen Hemminger, dev
On 12/8/2016 1:47 AM, Stephen Hemminger wrote:
> return statements at end of void functions are unnecessary and unwanted.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
But patch content is not just for sched/malloc as title suggests, it has
sched:
mem:
net/bonding:
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
2016-12-08 10:25 ` Ferruh Yigit
@ 2016-12-22 10:33 ` Thomas Monjalon
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2016-12-22 10:33 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Ferruh Yigit
2016-12-08 10:25, Ferruh Yigit:
> On 12/8/2016 1:47 AM, Stephen Hemminger wrote:
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -466,27 +466,20 @@ rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
> > int
> > rte_eth_dev_detach(uint8_t port_id, char *name)
> > {
> > - int ret = -1;
> > + int ret;
> >
> > - if (name == NULL) {
> > - ret = -EINVAL;
> > - goto err;
> > - }
> > + if (name == NULL)
> > + return -EINVAL;
> >
> > /* FIXME: move this to eal, once device flags are relocated there */
> > - if (rte_eth_dev_is_detachable(port_id))
> > - goto err;
> > + ret = rte_eth_dev_is_detachable(port_id);
> > + if (ret < 0)
>
> rte_eth_dev_is_detachable() can return 1 to indicate device is not
> detachable.
>
> > + return ret;
It should be
ret = rte_eth_dev_is_detachable(port_id);
if (ret)
return -1;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] minor cleanups
2016-12-08 1:47 [dpdk-dev] [PATCH 0/2] minor cleanups Stephen Hemminger
2016-12-08 1:47 ` [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Stephen Hemminger
2016-12-08 1:47 ` [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements Stephen Hemminger
@ 2017-01-09 17:09 ` Thomas Monjalon
2 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2017-01-09 17:09 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
Hi Stephen,
This series is still pending.
Would you mind to make a v2, please?
2016-12-07 17:47, Stephen Hemminger:
> Saw this while reviewing other changes
>
> Stephen Hemminger (2):
> eth: get rid of goto's in rte_eth_dev_detach
> sched/malloc: remove unnecesary return statements
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-01-09 17:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 1:47 [dpdk-dev] [PATCH 0/2] minor cleanups Stephen Hemminger
2016-12-08 1:47 ` [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach Stephen Hemminger
2016-12-08 10:25 ` Ferruh Yigit
2016-12-22 10:33 ` Thomas Monjalon
2016-12-08 1:47 ` [dpdk-dev] [PATCH 2/2] sched/malloc: remove unnecesary return statements Stephen Hemminger
2016-12-08 10:33 ` Ferruh Yigit
2017-01-09 17:09 ` [dpdk-dev] [PATCH 0/2] minor cleanups Thomas Monjalon
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).