mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 15:26:03 +09:00
net: fec: Only unregister MII bus if we registered it
If we fail to probe for whatever reason, we cannot unregister/free the
MII bus unless we registered it with fec_get_miibus. This fixes FECs
sharing an MDIO bus from destroying it, preventing the other FEC from
using it.
Fixes: 6a895d039b
("net: Update eQos driver and FEC driver to use eth phy interfaces")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
eccd132974
commit
cd4359194b
|
@ -1355,6 +1355,7 @@ static void fec_gpio_reset(struct fec_priv *priv)
|
||||||
|
|
||||||
static int fecmxc_probe(struct udevice *dev)
|
static int fecmxc_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
|
bool dm_mii_bus = true;
|
||||||
struct eth_pdata *pdata = dev_get_plat(dev);
|
struct eth_pdata *pdata = dev_get_plat(dev);
|
||||||
struct fec_priv *priv = dev_get_priv(dev);
|
struct fec_priv *priv = dev_get_priv(dev);
|
||||||
struct mii_dev *bus = NULL;
|
struct mii_dev *bus = NULL;
|
||||||
|
@ -1462,6 +1463,7 @@ static int fecmxc_probe(struct udevice *dev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!bus) {
|
if (!bus) {
|
||||||
|
dm_mii_bus = false;
|
||||||
#ifdef CONFIG_FEC_MXC_MDIO_BASE
|
#ifdef CONFIG_FEC_MXC_MDIO_BASE
|
||||||
bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE,
|
bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE,
|
||||||
dev_seq(dev));
|
dev_seq(dev));
|
||||||
|
@ -1507,8 +1509,10 @@ static int fecmxc_probe(struct udevice *dev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_phy:
|
err_phy:
|
||||||
mdio_unregister(bus);
|
if (!dm_mii_bus) {
|
||||||
free(bus);
|
mdio_unregister(bus);
|
||||||
|
free(bus);
|
||||||
|
}
|
||||||
err_mii:
|
err_mii:
|
||||||
err_timeout:
|
err_timeout:
|
||||||
fec_free_descs(priv);
|
fec_free_descs(priv);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user