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

Slawomir Mrozowicz slawomirx.mrozowicz at intel.com
Thu Apr 7 13:46:32 CEST 2016


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

Fixes: d6c99e62c852 ("ethdev: add buffered Tx")
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz at intel.com>
---
 lib/librte_ether/rte_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index dcf9e6f..0dc1025 100644
--- 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;
+
 	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) {
 
-	return 0;
+		ret_val = rte_eth_tx_buffer_set_err_callback(
+			buffer, rte_eth_tx_buffer_drop_callback, NULL);
+	}
+
+	return ret_val;
 }
 
 void
-- 
1.9.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.



More information about the dev mailing list