提交 3f639907 编写于 作者: J Jian Shen 提交者: David S. Miller

net: hns3: Standardize the handle of return value

Apply the standard minor cleanup by returning ret outside
the brackets.
Signed-off-by: NJian Shen <shenjian15@huawei.com>
Signed-off-by: NPeng Li <lipeng321@huawei.com>
Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 646cb512
......@@ -1108,12 +1108,12 @@ static int hclge_get_cfg(struct hclge_dev *hdev, struct hclge_cfg *hcfg)
ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_PF_CFG_DESC_NUM);
if (ret) {
dev_err(&hdev->pdev->dev,
"get config failed %d.\n", ret);
dev_err(&hdev->pdev->dev, "get config failed %d.\n", ret);
return ret;
}
hclge_parse_cfg(hcfg, desc);
return 0;
}
......@@ -1130,13 +1130,10 @@ static int hclge_get_cap(struct hclge_dev *hdev)
/* get pf resource */
ret = hclge_query_pf_resource(hdev);
if (ret) {
dev_err(&hdev->pdev->dev,
"query pf resource error %d.\n", ret);
return ret;
}
if (ret)
dev_err(&hdev->pdev->dev, "query pf resource error %d.\n", ret);
return 0;
return ret;
}
static int hclge_configure(struct hclge_dev *hdev)
......@@ -1265,13 +1262,10 @@ static int hclge_map_tqps_to_func(struct hclge_dev *hdev, u16 func_id,
req->tqp_vid = cpu_to_le16(tqp_vid);
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
dev_err(&hdev->pdev->dev, "TQP map failed %d.\n",
ret);
return ret;
}
if (ret)
dev_err(&hdev->pdev->dev, "TQP map failed %d.\n", ret);
return 0;
return ret;
}
static int hclge_assign_tqp(struct hclge_vport *vport,
......@@ -1330,12 +1324,10 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps)
return -ENOMEM;
ret = hclge_assign_tqp(vport, kinfo->tqp, kinfo->num_tqps);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev, "fail to assign TQPs %d.\n", ret);
return -EINVAL;
}
return 0;
return ret;
}
static int hclge_map_tqp_to_vport(struct hclge_dev *hdev,
......@@ -1487,13 +1479,11 @@ static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev,
}
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev, "tx buffer alloc cmd failed %d.\n",
ret);
return ret;
}
return 0;
return ret;
}
static int hclge_tx_buffer_alloc(struct hclge_dev *hdev,
......@@ -1501,13 +1491,10 @@ static int hclge_tx_buffer_alloc(struct hclge_dev *hdev,
{
int ret = hclge_cmd_alloc_tx_buff(hdev, buf_alloc);
if (ret) {
dev_err(&hdev->pdev->dev,
"tx buffer alloc failed %d\n", ret);
return ret;
}
if (ret)
dev_err(&hdev->pdev->dev, "tx buffer alloc failed %d\n", ret);
return 0;
return ret;
}
static int hclge_get_tc_num(struct hclge_dev *hdev)
......@@ -1825,13 +1812,11 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev,
(1 << HCLGE_TC0_PRI_BUF_EN_B));
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"rx private buffer alloc cmd failed %d\n", ret);
return ret;
}
return 0;
return ret;
}
static int hclge_rx_priv_wl_config(struct hclge_dev *hdev,
......@@ -1871,13 +1856,11 @@ static int hclge_rx_priv_wl_config(struct hclge_dev *hdev,
/* Send 2 descriptor at one time */
ret = hclge_cmd_send(&hdev->hw, desc, 2);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"rx private waterline config cmd failed %d\n",
ret);
return ret;
}
return 0;
}
static int hclge_common_thrd_config(struct hclge_dev *hdev,
......@@ -1917,12 +1900,10 @@ static int hclge_common_thrd_config(struct hclge_dev *hdev,
/* Send 2 descriptors at one time */
ret = hclge_cmd_send(&hdev->hw, desc, 2);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"common threshold config cmd failed %d\n", ret);
return ret;
}
return 0;
}
static int hclge_common_wl_config(struct hclge_dev *hdev,
......@@ -1943,13 +1924,11 @@ static int hclge_common_wl_config(struct hclge_dev *hdev,
req->com_wl.low |= cpu_to_le16(BIT(HCLGE_RX_PRIV_EN_B));
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"common waterline config cmd failed %d\n", ret);
return ret;
}
return 0;
return ret;
}
int hclge_buffer_alloc(struct hclge_dev *hdev)
......@@ -2196,13 +2175,11 @@ static int hclge_query_mac_an_speed_dup(struct hclge_dev *hdev, int *speed,
HCLGE_QUERY_SPEED_S);
ret = hclge_parse_speed(speed_tmp, speed);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"could not parse speed(=%d), %d\n", speed_tmp, ret);
return -EIO;
}
return 0;
return ret;
}
static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
......@@ -2219,13 +2196,11 @@ static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
req->cfg_an_cmd_flag = cpu_to_le32(flag);
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev, "auto neg set cmd failed %d.\n",
ret);
return ret;
}
return 0;
return ret;
}
static int hclge_set_autoneg(struct hnae3_handle *handle, bool enable)
......@@ -2331,13 +2306,11 @@ static int hclge_mac_init(struct hclge_dev *hdev)
mtu = ETH_DATA_LEN;
ret = hclge_set_mtu(handle, mtu);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"set mtu failed ret=%d\n", ret);
return ret;
}
return 0;
return ret;
}
static void hclge_mbx_task_schedule(struct hclge_dev *hdev)
......@@ -3121,13 +3094,11 @@ static int hclge_set_rss_tc_mode(struct hclge_dev *hdev, u16 *tc_valid,
}
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"Configure rss tc mode fail, status = %d\n", ret);
return ret;
}
return 0;
return ret;
}
static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
......@@ -3150,13 +3121,10 @@ static int hclge_set_rss_input_tuple(struct hclge_dev *hdev)
req->ipv6_sctp_en = hdev->vport[0].rss_tuple_sets.ipv6_sctp_en;
req->ipv6_fragment_en = hdev->vport[0].rss_tuple_sets.ipv6_fragment_en;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"Configure rss input fail, status = %d\n", ret);
return ret;
}
return 0;
}
static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
......@@ -3604,12 +3572,11 @@ int hclge_cmd_set_promisc_mode(struct hclge_dev *hdev,
HCLGE_PROMISC_TX_EN_B | HCLGE_PROMISC_RX_EN_B;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"Set promisc mode fail, status is %d.\n", ret);
return ret;
}
return 0;
}
void hclge_promisc_param_init(struct hclge_promisc_param *param, bool en_uc,
......@@ -3960,14 +3927,12 @@ static int hclge_set_mta_filter_mode(struct hclge_dev *hdev,
HCLGE_CFG_MTA_MAC_SEL_S, mta_mac_sel);
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"Config mat filter mode failed for cmd_send, ret =%d.\n",
ret);
return ret;
}
return 0;
return ret;
}
int hclge_cfg_func_mta_filter(struct hclge_dev *hdev,
......@@ -3986,14 +3951,12 @@ int hclge_cfg_func_mta_filter(struct hclge_dev *hdev,
req->function_id = func_id;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev,
"Config func_id enable failed for cmd_send, ret =%d.\n",
ret);
return ret;
}
return 0;
return ret;
}
static int hclge_set_mta_table_item(struct hclge_vport *vport,
......@@ -4598,13 +4561,11 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type,
req->vlan_fe = filter_en;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev, "set vlan filter fail, ret =%d.\n",
ret);
return ret;
}
return 0;
return ret;
}
#define HCLGE_FILTER_TYPE_VF 0
......@@ -4996,14 +4957,12 @@ static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mtu)
req->min_frm_size = HCLGE_MAC_MIN_FRAME;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
if (ret)
dev_err(&hdev->pdev->dev, "set mtu fail, ret =%d.\n", ret);
return ret;
}
else
hdev->mps = max_frm_size;
return 0;
return ret;
}
static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册