提交 c6dd6488 编写于 作者: C Claudiu Manoil 提交者: David S. Miller

enetc: Remove the imdio bus on PF probe bailout

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: 975d183e ("net: enetc: Initialize SerDes for SGMII and USXGMII protocols")
Signed-off-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7979a7d2
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册