diff options
author | Leon Romanovsky <leonro@nvidia.com> | 2021-09-25 14:22:59 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-27 18:32:00 +0300 |
commit | c89f78e985cc66513ec6848accab6f176512858d (patch) | |
tree | 692e621c195ff41ba98b40f3fe976771c437063d /drivers/ptp | |
parent | 504627ee4cf4a2d42cba7ce156d423299c06a618 (diff) | |
download | linux-c89f78e985cc66513ec6848accab6f176512858d.tar.xz |
ptp: ocp: Move devlink registration to be last devlink command
This change prevents from users to access device before devlink is
fully configured.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_ocp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 4c25467198e3..34f943c8c9fd 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -2455,7 +2455,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) return -ENOMEM; } - devlink_register(devlink); err = pci_enable_device(pdev); if (err) { dev_err(&pdev->dev, "pci_enable_device\n"); @@ -2497,7 +2496,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out; ptp_ocp_info(bp); - + devlink_register(devlink); return 0; out: @@ -2506,7 +2505,6 @@ out: out_disable: pci_disable_device(pdev); out_unregister: - devlink_unregister(devlink); devlink_free(devlink); return err; } @@ -2517,11 +2515,11 @@ ptp_ocp_remove(struct pci_dev *pdev) struct ptp_ocp *bp = pci_get_drvdata(pdev); struct devlink *devlink = priv_to_devlink(bp); + devlink_unregister(devlink); ptp_ocp_detach(bp); pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); - devlink_unregister(devlink); devlink_free(devlink); } |