[dpdk-dev] [PATCH] ethdev: fix CID 124557 unchecked return value

Thomas Monjalon thomas.monjalon at 6wind.com
Thu Apr 7 19:09:12 CEST 2016


2016-04-07 13:46, Slawomir Mrozowicz:
> It fix coverity issue:
> CID 124557 (#1 of 1): Unchecked return value (CHECKED_RETURN)
> 3. check_return: Calling rte_eth_tx_buffer_set_err_callback without checking return value (as is done elsewhere 6 out of 7 times).

Lines must be wrapped.

> Fixes: d6c99e62c852 ("ethdev: add buffered Tx")
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
|...]
|> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1342,15 +1342,19 @@ rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer,
>  int
>  rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)
>  {
> +	int ret_val = 0;

The name "ret" is more common in this file.

> +
>  	if (buffer == NULL)
>  		return -EINVAL;
>  
>  	buffer->size = size;
> -	if (buffer->error_callback == NULL)
> -		rte_eth_tx_buffer_set_err_callback(buffer,
> -				rte_eth_tx_buffer_drop_callback, NULL);
> +	if (buffer->error_callback == NULL) {
>  

This blank line can be removed.

> -	return 0;
> +		ret_val = rte_eth_tx_buffer_set_err_callback(
> +			buffer, rte_eth_tx_buffer_drop_callback, NULL);
> +	}
> +
> +	return ret_val;
>  }

Applied with above small changes, thanks and welcome :)


More information about the dev mailing list