[dpdk-dev,1/2] net/avf: fix unchecked return value issue

Message ID 1517291671-56210-1-git-send-email-jingjing.wu@intel.com
State Superseded, archived
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Wu, Jingjing Jan. 30, 2018, 5:54 a.m.
This patch fixes the coverity CHECKED_RETURN issue.

Coverity issue: 257045
Fixes: 48de41ca11f0 ("net/avf: enable link status update")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/avf/avf_ethdev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index cf7bbb2..511715f 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -609,9 +609,10 @@  avf_dev_link_update(struct rte_eth_dev *dev,
 	new_link.link_autoneg = !!(dev->data->dev_conf.link_speeds &
 				ETH_LINK_SPEED_FIXED);
 
-	rte_atomic64_cmpset((uint64_t *)&dev->data->dev_link,
-			    *(uint64_t *)&dev->data->dev_link,
-			    *(uint64_t *)&new_link);
+	if(rte_atomic64_cmpset((uint64_t *)&dev->data->dev_link,
+			       *(uint64_t *)&dev->data->dev_link,
+			       *(uint64_t *)&new_link) == 0)
+		return -1;
 
 	return 0;
 }