DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
Date: Thu, 8 Dec 2016 10:25:07 +0000	[thread overview]
Message-ID: <4179dac2-f433-ca40-2f4f-235abab77c6c@intel.com> (raw)
In-Reply-To: <20161208014751.24285-2-stephen@networkplumber.org>

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
> 

  reply	other threads:[~2016-12-08 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=4179dac2-f433-ca40-2f4f-235abab77c6c@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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).