|
@@ -1624,17 +1624,17 @@ static int hclgevf_init_client_instance(struct hnae3_client *client,
|
|
|
|
|
|
ret = client->ops->init_instance(&hdev->nic);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_nic;
|
|
|
|
|
|
if (hdev->roce_client && hnae3_dev_roce_supported(hdev)) {
|
|
|
struct hnae3_client *rc = hdev->roce_client;
|
|
|
|
|
|
ret = hclgevf_init_roce_base_info(hdev);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_roce;
|
|
|
ret = rc->ops->init_instance(&hdev->roce);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_roce;
|
|
|
}
|
|
|
break;
|
|
|
case HNAE3_CLIENT_UNIC:
|
|
@@ -1643,7 +1643,7 @@ static int hclgevf_init_client_instance(struct hnae3_client *client,
|
|
|
|
|
|
ret = client->ops->init_instance(&hdev->nic);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_nic;
|
|
|
break;
|
|
|
case HNAE3_CLIENT_ROCE:
|
|
|
if (hnae3_dev_roce_supported(hdev)) {
|
|
@@ -1654,15 +1654,24 @@ static int hclgevf_init_client_instance(struct hnae3_client *client,
|
|
|
if (hdev->roce_client && hdev->nic_client) {
|
|
|
ret = hclgevf_init_roce_base_info(hdev);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_roce;
|
|
|
|
|
|
ret = client->ops->init_instance(&hdev->roce);
|
|
|
if (ret)
|
|
|
- return ret;
|
|
|
+ goto clear_roce;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
+
|
|
|
+clear_nic:
|
|
|
+ hdev->nic_client = NULL;
|
|
|
+ hdev->nic.client = NULL;
|
|
|
+ return ret;
|
|
|
+clear_roce:
|
|
|
+ hdev->roce_client = NULL;
|
|
|
+ hdev->roce.client = NULL;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
static void hclgevf_uninit_client_instance(struct hnae3_client *client,
|
|
@@ -1671,13 +1680,19 @@ static void hclgevf_uninit_client_instance(struct hnae3_client *client,
|
|
|
struct hclgevf_dev *hdev = ae_dev->priv;
|
|
|
|
|
|
/* un-init roce, if it exists */
|
|
|
- if (hdev->roce_client)
|
|
|
+ if (hdev->roce_client) {
|
|
|
hdev->roce_client->ops->uninit_instance(&hdev->roce, 0);
|
|
|
+ hdev->roce_client = NULL;
|
|
|
+ hdev->roce.client = NULL;
|
|
|
+ }
|
|
|
|
|
|
/* un-init nic/unic, if this was not called by roce client */
|
|
|
- if ((client->ops->uninit_instance) &&
|
|
|
- (client->type != HNAE3_CLIENT_ROCE))
|
|
|
+ if (client->ops->uninit_instance && hdev->nic_client &&
|
|
|
+ client->type != HNAE3_CLIENT_ROCE) {
|
|
|
client->ops->uninit_instance(&hdev->nic, 0);
|
|
|
+ hdev->nic_client = NULL;
|
|
|
+ hdev->nic.client = NULL;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static int hclgevf_pci_init(struct hclgevf_dev *hdev)
|