From 49d443a915ebfda8e41bfd0b78244bcbe110eef3 Mon Sep 17 00:00:00 2001
From: Shaozhengchao <shaozhengchao@huawei.com>
Date: Thu, 17 Oct 2019 16:54:23 +0800
Subject: [PATCH 2776/2944] openeuler: net/hinic: fix static check problem

commit e3efbbe9094aecfd65be5a28bf5b363896371e61 openEuler-1.0

driver inclusion
category:cleanup
bugzilla:4472
CVE:NA

-----------------------------------------------------------------------

fix static check problem.

Signed-off-by: Shaozhengchao <shaozhengchao@huawei.com>
Reviewed-by: Luoshaokai <luoshaokai@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Xin Hao <haoxing990@gmail.com>
Reviewed-by: Baolin Wang <baolin.wang@openanolis.org>
---
 drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.c |  8 ++------
 drivers/net/ethernet/huawei/hinic/hinic_dcb.c         |  2 +-
 drivers/net/ethernet/huawei/hinic/hinic_lld.c         | 11 ++++++-----
 drivers/net/ethernet/huawei/hinic/hinic_nic_dbg.c     |  6 ++++--
 drivers/net/ethernet/huawei/hinic/hinic_nictool.c     | 13 ++++++-------
 5 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.c b/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.c
index a05ec86..fb915fb 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_dbgtool_knl.c
@@ -411,14 +411,10 @@ long dbgtool_knl_ffm_info_rd(struct dbgtool_param *para,
  * @para: unused
  * @dbgtool_info: the dbgtool info
  **/
-long dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
+void dbgtool_knl_ffm_info_clr(struct dbgtool_param *para,
 			      struct dbgtool_k_glb_info *dbgtool_info)
 {
-	long ret = 0;
-
 	dbgtool_info->ffm->ffm_num = 0;
-
-	return ret;
 }
 
 /**
@@ -600,7 +596,7 @@ long dbgtool_knl_unlocked_ioctl(struct file *pfile,
 		ret = dbgtool_knl_ffm_info_rd(&param, dbgtool_info);
 		break;
 	case DBGTOOL_CMD_FFM_CLR:
-		ret = dbgtool_knl_ffm_info_clr(&param, dbgtool_info);
+		dbgtool_knl_ffm_info_clr(&param, dbgtool_info);
 		break;
 	case DBGTOOL_CMD_PF_DEV_INFO_GET:
 		ret = dbgtool_knl_pf_dev_info_get(&param,
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dcb.c b/drivers/net/ethernet/huawei/hinic/hinic_dcb.c
index 480d19b..1270620 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_dcb.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_dcb.c
@@ -600,7 +600,7 @@ void hinic_dcbnl_set_pfc_en_tool(struct net_device *netdev,
 	if (flag)
 		nic_dev->tmp_dcb_cfg.pfc_state = !!(*value);
 	else
-		*value = !!nic_dev->tmp_dcb_cfg.pfc_state;
+		*value = nic_dev->tmp_dcb_cfg.pfc_state;
 }
 
 void hinic_dcbnl_set_ets_en_tool(struct net_device *netdev,
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_lld.c b/drivers/net/ethernet/huawei/hinic/hinic_lld.c
index 60dccca..a511fb2 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_lld.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_lld.c
@@ -1270,9 +1270,9 @@ void hinic_get_card_info(void *hwdev, void *bufin)
 	lld_dev_put();
 }
 
-int hinic_get_card_func_info_by_card_name(const char *chip_name,
-					  struct hinic_card_func_info
-					  *card_func)
+void hinic_get_card_func_info_by_card_name(const char *chip_name,
+					   struct hinic_card_func_info
+					   *card_func)
 {
 	struct card_node *chip_node = NULL;
 	struct hinic_pcidev *dev;
@@ -1305,7 +1305,7 @@ int hinic_get_card_func_info_by_card_name(const char *chip_name,
 
 	lld_dev_put();
 
-	return 0;
+	return;
 }
 
 int hinic_get_device_id(void *hwdev, u16 *dev_id)
@@ -2148,6 +2148,7 @@ static int hinic_pci_init(struct pci_dev *pdev)
 dma_consistnet_mask_err:
 dma_mask_err:
 	pci_clear_master(pdev);
+	pci_disable_pcie_error_reporting(pdev);
 	pci_release_regions(pdev);
 
 pci_regions_err:
@@ -2681,7 +2682,7 @@ static void hinic_shutdown(struct pci_dev *pdev)
 {
 	struct hinic_pcidev *pci_adapter = pci_get_drvdata(pdev);
 
-	sdk_err(&pdev->dev, "Shutdown device\n");
+	sdk_info(&pdev->dev, "Shutdown device\n");
 
 	if (pci_adapter)
 		hinic_shutdown_hwdev(pci_adapter->hwdev);
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_dbg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_dbg.c
index 7dd751e..35135e5 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_nic_dbg.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_dbg.c
@@ -31,6 +31,8 @@
 #include "hinic_nic.h"
 #include "hinic_dbg.h"
 
+#define INVALID_PI (65535)
+
 u16 hinic_dbg_get_qp_num(void *hwdev)
 {
 	struct hinic_nic_io *nic_io;
@@ -101,7 +103,7 @@ u16 hinic_dbg_get_rq_hw_pi(void *hwdev, u16 q_id)
 
 	nic_err(((struct hinic_hwdev *)hwdev)->dev_hdl, "Get rq hw pi failed!\n");
 
-	return 65535;
+	return INVALID_PI;
 }
 
 u16 hinic_dbg_get_rq_sw_pi(void *hwdev, u16 q_id)
@@ -254,7 +256,7 @@ void hinic_get_chip_fault_stats(const void *hwdev,
 	int copy_len = offset + MAX_DRV_BUF_SIZE - HINIC_CHIP_FAULT_SIZE;
 
 	if (offset < 0 || offset > HINIC_CHIP_FAULT_SIZE) {
-		pr_err("offset %d greater than chip fault max size\n",
+		pr_err("Invalid chip offset value: %d\n",
 		       offset);
 		return;
 	}
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c
index 93e7b5c..f611b8b 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_nictool.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_nictool.c
@@ -661,7 +661,7 @@ static int set_link_mode(struct hinic_nic_dev *nic_dev, void *buf_in,
 }
 
 static int set_dcb_cfg(struct hinic_nic_dev *nic_dev, void *buf_in,
-			   u32 in_size, void *buf_out, u32 *out_size)
+			u32 in_size, void *buf_out, u32 *out_size)
 {
 	union _dcb_ctl dcb_ctl = {.data = 0};
 	int err;
@@ -990,7 +990,7 @@ static int set_poll_weight(struct hinic_nic_dev *nic_dev, void *buf_in,
 
 	if (!buf_in || in_size != sizeof(*weight_info)) {
 		nicif_err(nic_dev, drv, nic_dev->netdev,
-			  "Unexpect in buf size from user :%d, expect: %lu\n",
+			  "Unexpect in buf size from user :%u, expect: %lu\n",
 			  *out_size, sizeof(*weight_info));
 		return -EFAULT;
 	}
@@ -1399,8 +1399,9 @@ static int knl_free_mem(char *dev_name, struct msg_module *nt_msg)
 	return 0;
 }
 
-extern int hinic_get_card_func_info_by_card_name(const char *chip_name,
-				struct hinic_card_func_info *card_func);
+extern void hinic_get_card_func_info_by_card_name(const char *chip_name,
+						  struct hinic_card_func_info
+						  *card_func);
 
 static int get_card_func_info(char *dev_name, struct msg_module *nt_msg)
 {
@@ -1432,9 +1433,7 @@ static int get_card_func_info(char *dev_name, struct msg_module *nt_msg)
 		return -EINVAL;
 	}
 
-	err = hinic_get_card_func_info_by_card_name(dev_name, &card_func_info);
-	if (err)
-		return err;
+	hinic_get_card_func_info_by_card_name(dev_name, &card_func_info);
 
 	if (!card_func_info.num_pf) {
 		pr_err("None function found for %s\n", dev_name);
-- 
1.8.3.1

