From: Slawomir Mrozowicz Date: Thu, 7 Apr 2016 11:46:32 +0000 (+0200) Subject: ethdev: fix unchecked return value X-Git-Tag: spdx-start~7049 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7d788417543c5a2e61504c11dea228bd2378c46d;p=dpdk.git ethdev: fix unchecked return value It fix coverity issue: CID 124557 (#1 of 1): Unchecked return value (CHECKED_RETURN) check_return: Calling rte_eth_tx_buffer_set_err_callback without checking return value (as is done elsewhere 6 out of 7 times). Fixes: d6c99e62c852 ("ethdev: add buffered Tx") Signed-off-by: Slawomir Mrozowicz --- diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index bd54e1f3fd..a31018e88d 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1342,15 +1342,18 @@ 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 = 0; + 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) { + ret = rte_eth_tx_buffer_set_err_callback( + buffer, rte_eth_tx_buffer_drop_callback, NULL); + } - return 0; + return ret; } void