[2/4] net/hns3: avoid unchecked return value in reset err process

Message ID 1591692257-55884-3-git-send-email-xavier.huwei@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Bugfixes of coverity defects for hns3 PMD driver |

Checks

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

Commit Message

Wei Hu (Xavier) June 9, 2020, 8:44 a.m. UTC
  From: Hongbo Zheng <zhenghongbo3@huawei.com>

There is a coverity defect related "Unchecked return value".

The internal static hns3_reset_err_handle function is reset error process
of hns3 PMD driver. If failure in reset process, it does not mean that the
network port is completely unavailable. so the command interface between
driver and firmware still needs to be initialized. Regardless of whether
the execution of the function named hns3_cmd_init is successful or not,
the next process after execution must be continued, so there is no need to
check the return value. If hns3_cmd_init fails to execute, there will be
corresponding log information inside hns3_cmd_init.

This patch adds '(void)' Type conversion to avoid coverity warnning.

Coverity issue: 349934
Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_intr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index 9953a1d..46d617c 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -882,8 +882,14 @@  hns3_reset_err_handle(struct hns3_adapter *hns)
 		return true;
 	}
 
+	/*
+	 * Failure to reset does not mean that the network port is
+	 * completely unavailable, so cmd still needs to be initialized.
+	 * Regardless of whether the execution is successful or not, the
+	 * flow after execution must be continued.
+	 */
 	if (rte_atomic16_read(&hw->reset.disable_cmd))
-		hns3_cmd_init(hw);
+		(void)hns3_cmd_init(hw);
 reset_fail:
 	hw->reset.attempts = 0;
 	hw->reset.stats.fail_cnt++;