mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-20 20:08:55 +07:00
net: hns3: change hnae3_register_ae_dev() to int
hnae3_register_ae_dev() may fail, and it should return a error code to its caller, so change hnae3_register_ae_dev() return type to int. Also, when hnae3_register_ae_dev() return error, hns3_probe() should do some error handling and return the error code. 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>
This commit is contained in:
parent
fc0c174f42
commit
74354140a5
@ -238,7 +238,7 @@ EXPORT_SYMBOL(hnae3_unregister_ae_algo);
|
||||
* @ae_dev: the AE device
|
||||
* NOTE: the duplicated name will not be checked
|
||||
*/
|
||||
void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||
int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||
{
|
||||
const struct pci_device_id *id;
|
||||
struct hnae3_ae_algo *ae_algo;
|
||||
@ -259,6 +259,7 @@ void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||
|
||||
if (!ae_dev->ops) {
|
||||
dev_err(&ae_dev->pdev->dev, "ae_dev ops are null\n");
|
||||
ret = -EOPNOTSUPP;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
@ -285,8 +286,15 @@ void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
|
||||
ret);
|
||||
}
|
||||
|
||||
out_err:
|
||||
mutex_unlock(&hnae3_common_lock);
|
||||
|
||||
return 0;
|
||||
|
||||
out_err:
|
||||
list_del(&ae_dev->node);
|
||||
mutex_unlock(&hnae3_common_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(hnae3_register_ae_dev);
|
||||
|
||||
|
@ -587,7 +587,7 @@ struct hnae3_handle {
|
||||
#define hnae3_get_bit(origin, shift) \
|
||||
hnae3_get_field((origin), (0x1 << (shift)), (shift))
|
||||
|
||||
void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||
int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||
void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||
|
||||
void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo);
|
||||
|
@ -1752,9 +1752,13 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
hns3_get_dev_capability(pdev, ae_dev);
|
||||
pci_set_drvdata(pdev, ae_dev);
|
||||
|
||||
hnae3_register_ae_dev(ae_dev);
|
||||
ret = hnae3_register_ae_dev(ae_dev);
|
||||
if (ret) {
|
||||
devm_kfree(&pdev->dev, ae_dev);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* hns3_remove - Device removal routine
|
||||
|
Loading…
Reference in New Issue
Block a user