Skip to content

Commit

Permalink
net: hns3: add error handler for initializing command queue
Browse files Browse the repository at this point in the history
This patch adds error handler for the failure of command queue
initialization both PF and VF.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Huazhong Tan authored and David S. Miller committed Apr 8, 2019
1 parent 18e2488 commit 4339ef3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,21 +373,26 @@ int hclge_cmd_init(struct hclge_dev *hdev)
* reset may happen when lower level reset is being processed.
*/
if ((hclge_is_reset_pending(hdev))) {
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
return -EBUSY;
ret = -EBUSY;
goto err_cmd_init;
}

ret = hclge_cmd_query_firmware_version(&hdev->hw, &version);
if (ret) {
dev_err(&hdev->pdev->dev,
"firmware version query failed %d\n", ret);
return ret;
goto err_cmd_init;
}
hdev->fw_version = version;

dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);

return 0;

err_cmd_init:
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);

return ret;
}

static void hclge_cmd_uninit_regs(struct hclge_hw *hw)
Expand Down
11 changes: 8 additions & 3 deletions drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,22 +357,27 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev)
* reset may happen when lower level reset is being processed.
*/
if (hclgevf_is_reset_pending(hdev)) {
set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state);
return -EBUSY;
ret = -EBUSY;
goto err_cmd_init;
}

/* get firmware version */
ret = hclgevf_cmd_query_firmware_version(&hdev->hw, &version);
if (ret) {
dev_err(&hdev->pdev->dev,
"failed(%d) to query firmware version\n", ret);
return ret;
goto err_cmd_init;
}
hdev->fw_version = version;

dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);

return 0;

err_cmd_init:
set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state);

return ret;
}

static void hclgevf_cmd_uninit_regs(struct hclgevf_hw *hw)
Expand Down

0 comments on commit 4339ef3

Please sign in to comment.