arch: powerpc: mpc85xx: free MDIO bus if mdio_register fails

If mdio_register fails, it is nice to not leave behind dangling
allocated memory.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
Vladimir Oltean
2021-09-27 14:22:04 +03:00
committed by Ramon Fried
parent 4fdc7e3530
commit 19ef59f1e0

View File

@@ -449,8 +449,10 @@ int fec_initialize(struct bd_info *bis)
mdiodev->write = bb_miiphy_write;
retval = mdio_register(mdiodev);
if (retval < 0)
if (retval < 0) {
mdio_free(mdiodev);
return retval;
}
#endif
}