2022-06-08 12:31:44

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 net-next 4/5] ptp_ocp: do not call pci_set_drvdata(pdev, NULL)

Cleaning up driver data is actually already handled by driver core,
so there is no need to do it manually.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/ptp/ptp_ocp.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 4e237f806085..857e35c68a04 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -3769,7 +3769,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)

out:
ptp_ocp_detach(bp);
- pci_set_drvdata(pdev, NULL);
out_disable:
pci_disable_device(pdev);
out_free:
@@ -3785,7 +3784,6 @@ ptp_ocp_remove(struct pci_dev *pdev)

devlink_unregister(devlink);
ptp_ocp_detach(bp);
- pci_set_drvdata(pdev, NULL);
pci_disable_device(pdev);

devlink_free(devlink);
--
2.35.1


2022-06-08 22:19:26

by Vadim Fedorenko

[permalink] [raw]
Subject: Re: [PATCH v1 net-next 4/5] ptp_ocp: do not call pci_set_drvdata(pdev, NULL)

On 08.06.2022 13:03, Andy Shevchenko wrote:
> Cleaning up driver data is actually already handled by driver core,
> so there is no need to do it manually.

I found a couple of places with exactly the same code in error path.
For example Marvell's OcteonX drivers in crypto and net subsystems.
Should we fix them too?

> Signed-off-by: Andy Shevchenko <[email protected]>

Overall looks good.

Acked-by: Vadim Fedorenko <[email protected]>

> ---
> drivers/ptp/ptp_ocp.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 4e237f806085..857e35c68a04 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -3769,7 +3769,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> out:
> ptp_ocp_detach(bp);
> - pci_set_drvdata(pdev, NULL);
> out_disable:
> pci_disable_device(pdev);
> out_free:
> @@ -3785,7 +3784,6 @@ ptp_ocp_remove(struct pci_dev *pdev)
>
> devlink_unregister(devlink);
> ptp_ocp_detach(bp);
> - pci_set_drvdata(pdev, NULL);
> pci_disable_device(pdev);
>
> devlink_free(devlink);

2022-06-09 11:06:55

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 net-next 4/5] ptp_ocp: do not call pci_set_drvdata(pdev, NULL)

On Thu, Jun 9, 2022 at 12:01 AM Vadim Fedorenko <[email protected]> wrote:
>
> On 08.06.2022 13:03, Andy Shevchenko wrote:
> > Cleaning up driver data is actually already handled by driver core,
> > so there is no need to do it manually.
>
> I found a couple of places with exactly the same code in error path.
> For example Marvell's OcteonX drivers in crypto and net subsystems.
> Should we fix them too?

I believe there are even more, but feel free to fix them, they are not my POI.

...

> Overall looks good.
>
> Acked-by: Vadim Fedorenko <[email protected]>

Thanks!

--
With Best Regards,
Andy Shevchenko