From patchwork Tue Jun 9 08:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 70993 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31169A04FA; Tue, 9 Jun 2020 10:46:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A61BD2BF7; Tue, 9 Jun 2020 10:46:00 +0200 (CEST) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 801D529D6 for ; Tue, 9 Jun 2020 10:45:57 +0200 (CEST) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8663DF5BF3E8C82DD536 for ; Tue, 9 Jun 2020 16:45:55 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Tue, 9 Jun 2020 16:45:46 +0800 From: "Wei Hu (Xavier)" To: CC: , Date: Tue, 9 Jun 2020 16:44:15 +0800 Message-ID: <1591692257-55884-3-git-send-email-xavier.huwei@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591692257-55884-1-git-send-email-xavier.huwei@huawei.com> References: <1591692257-55884-1-git-send-email-xavier.huwei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/4] net/hns3: avoid unchecked return value in reset err process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hongbo Zheng 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 Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_intr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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++;