[dpdk-dev] [PATCH 1/2] eth: get rid of goto's in rte_eth_dev_detach
Thomas Monjalon
thomas.monjalon at 6wind.com
Thu Dec 22 11:33:40 CET 2016
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;
More information about the dev
mailing list