From: Vladimir Oltean Date: Mon, 27 Sep 2021 11:22:04 +0000 (+0300) Subject: arch: powerpc: mpc85xx: free MDIO bus if mdio_register fails X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=19ef59f1e098a977272080f5a7321169d8b98f34;p=u-boot.git 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 Reviewed-by: Ramon Fried --- diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c index 1f6f557073..5cf0a3fb22 100644 --- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c +++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c @@ -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 }