[dpdk-dev] [PATCH 2/7] ethdev: reduce goto's in attach/detach

Ferruh Yigit ferruh.yigit at intel.com
Wed Feb 1 18:26:49 CET 2017


On 1/10/2017 8:40 AM, Thomas Monjalon wrote:
> 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.

In case it is not obvious, this patchset is stuck because of above
change request not addressed.

> 
>>  
>>  	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