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-Tag: baikal/mips/sdk5.9~15^2^2~102^2~6^2~1 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=354395f1cbb90c1370e392928f781262e6d2fe4a;p=uboot.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 }