On 12/8/2016 1:47 AM, Stephen Hemminger wrote:
> Extra goto's to just a return are unnecessary.
> 
> Signed-off-by: Stephen Hemminger <step...@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 via email to