net/avf: fix unchecked return in link update
authorJingjing Wu <jingjing.wu@intel.com>
Tue, 30 Jan 2018 09:10:36 +0000 (17:10 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 31 Jan 2018 19:57:29 +0000 (20:57 +0100)
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

index b1be7f4..3f210b2 100644 (file)
@@ -611,9 +611,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;
 }