* [PATCH net-next] enetc: Remove the imdio bus on PF probe bailout
@ 2020-07-22 12:38 Claudiu Manoil
2020-07-23 0:32 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Claudiu Manoil @ 2020-07-22 12:38 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev
enetc_imdio_remove() is missing from the enetc_pf_probe()
bailout path. Not surprisingly because enetc_setup_serdes()
is registering the imdio bus for internal purposes, and it's
not obvious that enetc_imdio_remove() currently performs the
teardown of enetc_setup_serdes().
To fix this, define enetc_teardown_serdes() to wrap
enetc_imdio_remove() (improve code maintenance) and call it
on bailout and remove paths.
Fixes: 975d183ef0ca ("net: enetc: Initialize SerDes for SGMII and USXGMII protocols")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc_pf.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 5a08f66b123c..1d2158fd9a28 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -966,6 +966,13 @@ static int enetc_configure_serdes(struct enetc_ndev_priv *priv)
return 0;
}
+static void enetc_teardown_serdes(struct enetc_ndev_priv *priv)
+{
+ struct enetc_pf *pf = enetc_si_priv(priv->si);
+
+ enetc_imdio_remove(pf);
+}
+
static int enetc_pf_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1045,6 +1052,7 @@ static int enetc_pf_probe(struct pci_dev *pdev,
return 0;
err_reg_netdev:
+ enetc_teardown_serdes(priv);
enetc_free_msix(priv);
err_alloc_msix:
enetc_free_si_resources(priv);
@@ -1071,7 +1079,7 @@ static void enetc_pf_remove(struct pci_dev *pdev)
priv = netdev_priv(si->ndev);
unregister_netdev(si->ndev);
- enetc_imdio_remove(pf);
+ enetc_teardown_serdes(priv);
enetc_mdio_remove(pf);
enetc_of_put_phy(pf);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] enetc: Remove the imdio bus on PF probe bailout
2020-07-22 12:38 [PATCH net-next] enetc: Remove the imdio bus on PF probe bailout Claudiu Manoil
@ 2020-07-23 0:32 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-23 0:32 UTC (permalink / raw)
To: claudiu.manoil; +Cc: netdev
From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: Wed, 22 Jul 2020 15:38:48 +0300
> enetc_imdio_remove() is missing from the enetc_pf_probe()
> bailout path. Not surprisingly because enetc_setup_serdes()
> is registering the imdio bus for internal purposes, and it's
> not obvious that enetc_imdio_remove() currently performs the
> teardown of enetc_setup_serdes().
> To fix this, define enetc_teardown_serdes() to wrap
> enetc_imdio_remove() (improve code maintenance) and call it
> on bailout and remove paths.
>
> Fixes: 975d183ef0ca ("net: enetc: Initialize SerDes for SGMII and USXGMII protocols")
> Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-23 0:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 12:38 [PATCH net-next] enetc: Remove the imdio bus on PF probe bailout Claudiu Manoil
2020-07-23 0:32 ` David Miller
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).