Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] ptp: ocp: Fix missing pci_disable_device() on error in ptp_ocp_probe()
@ 2021-08-10 12:54 Yang Yingliang
  2021-08-11 18:44 ` Jonathan Lemon
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-08-10 12:54 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: richardcochran, davem

If ptp_ocp_device_init() fails, pci_disable_device() need be
called, fix this by using pcim_enable_device().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/ptp/ptp_ocp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 92edf772feed..04cce8d3b1f6 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -1429,7 +1429,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (err)
 		goto out_free;
 
-	err = pci_enable_device(pdev);
+	err = pcim_enable_device(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "pci_enable_device\n");
 		goto out_unregister;
@@ -1476,7 +1476,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 out:
 	ptp_ocp_detach(bp);
-	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
 out_unregister:
 	devlink_unregister(devlink);
@@ -1493,7 +1492,6 @@ ptp_ocp_remove(struct pci_dev *pdev)
 	struct devlink *devlink = priv_to_devlink(bp);
 
 	ptp_ocp_detach(bp);
-	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
 
 	devlink_unregister(devlink);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] ptp: ocp: Fix missing pci_disable_device() on error in ptp_ocp_probe()
  2021-08-10 12:54 [PATCH -next] ptp: ocp: Fix missing pci_disable_device() on error in ptp_ocp_probe() Yang Yingliang
@ 2021-08-11 18:44 ` Jonathan Lemon
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Lemon @ 2021-08-11 18:44 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, netdev, richardcochran, davem

On Tue, Aug 10, 2021 at 08:54:53PM +0800, Yang Yingliang wrote:
> If ptp_ocp_device_init() fails, pci_disable_device() need be
> called, fix this by using pcim_enable_device().

I just posted an alternate patch to address this.
-- 
Jonathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-11 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 12:54 [PATCH -next] ptp: ocp: Fix missing pci_disable_device() on error in ptp_ocp_probe() Yang Yingliang
2021-08-11 18:44 ` Jonathan Lemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).