diff mbox

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

Message ID 1517303436-57290-1-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Checks

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

Commit Message

Wu, Jingjing Jan. 30, 2018, 9:10 a.m. UTC
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(-)

Comments

Ferruh Yigit Jan. 31, 2018, 7:20 p.m. UTC | #1
On 1/30/2018 9:10 AM, Jingjing Wu wrote:
> 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>

Applied to dpdk-next-net/master, thanks.
diff mbox

Patch

diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index cf7bbb2..3009f5d 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;
 }