[dpdk-dev] [PATCH 2/7] ethdev: reduce goto's in attach/detach
Thomas Monjalon
thomas.monjalon at 6wind.com
Tue Jan 10 09:40:46 CET 2017
Hi Stephen,
Please use --in-reply-to to keep v1 and v2 in the same thread.
Comment below
2017-01-09 15:30, Stephen Hemminger:
> 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;
As commented on v1 by Ferruh and I, you should check also positive value.
>
> 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);
> }
More information about the dev
mailing list