Commit d9fdbf13 authored by Jonathan Lemon's avatar Jonathan Lemon Committed by Jakub Kicinski

ptp: ocp: Fix error path for pci_ocp_device_init()

If ptp_ocp_device_init() fails, pci_disable_device() is skipped.
Fix the error handling so this case is covered.  Update ptp_ocp_remove()
so the normal exit path is identical.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Fixes: 773bda96 ("ptp: ocp: Expose various resources on the timecard.")
Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7c807572
...@@ -1438,7 +1438,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1438,7 +1438,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
bp = devlink_priv(devlink); bp = devlink_priv(devlink);
err = ptp_ocp_device_init(bp, pdev); err = ptp_ocp_device_init(bp, pdev);
if (err) if (err)
goto out_unregister; goto out_disable;
/* compat mode. /* compat mode.
* Older FPGA firmware only returns 2 irq's. * Older FPGA firmware only returns 2 irq's.
...@@ -1476,8 +1476,9 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1476,8 +1476,9 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
out: out:
ptp_ocp_detach(bp); ptp_ocp_detach(bp);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
out_disable:
pci_disable_device(pdev);
out_unregister: out_unregister:
devlink_unregister(devlink); devlink_unregister(devlink);
out_free: out_free:
...@@ -1493,8 +1494,8 @@ ptp_ocp_remove(struct pci_dev *pdev) ...@@ -1493,8 +1494,8 @@ ptp_ocp_remove(struct pci_dev *pdev)
struct devlink *devlink = priv_to_devlink(bp); struct devlink *devlink = priv_to_devlink(bp);
ptp_ocp_detach(bp); ptp_ocp_detach(bp);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
pci_disable_device(pdev);
devlink_unregister(devlink); devlink_unregister(devlink);
devlink_free(devlink); devlink_free(devlink);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment