Skip to content

Commit

Permalink
net: hns3: cleanup of return values in hclge_init_client_instance()
Browse files Browse the repository at this point in the history
Removes the goto and directly returns in case of errors as part of the
cleanup.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jian Shen authored and David S. Miller committed May 20, 2018
1 parent e63cd65 commit 99a6993
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5297,19 +5297,19 @@ static int hclge_init_client_instance(struct hnae3_client *client,
vport->nic.client = client;
ret = client->ops->init_instance(&vport->nic);
if (ret)
goto err;
return ret;

if (hdev->roce_client &&
hnae3_dev_roce_supported(hdev)) {
struct hnae3_client *rc = hdev->roce_client;

ret = hclge_init_roce_base_info(vport);
if (ret)
goto err;
return ret;

ret = rc->ops->init_instance(&vport->roce);
if (ret)
goto err;
return ret;
}

break;
Expand All @@ -5319,7 +5319,7 @@ static int hclge_init_client_instance(struct hnae3_client *client,

ret = client->ops->init_instance(&vport->nic);
if (ret)
goto err;
return ret;

break;
case HNAE3_CLIENT_ROCE:
Expand All @@ -5331,18 +5331,16 @@ static int hclge_init_client_instance(struct hnae3_client *client,
if (hdev->roce_client && hdev->nic_client) {
ret = hclge_init_roce_base_info(vport);
if (ret)
goto err;
return ret;

ret = client->ops->init_instance(&vport->roce);
if (ret)
goto err;
return ret;
}
}
}

return 0;
err:
return ret;
}

static void hclge_uninit_client_instance(struct hnae3_client *client,
Expand Down

0 comments on commit 99a6993

Please sign in to comment.