]> git.baikalelectronics.ru Git - uboot.git/commitdiff
arch: powerpc: mpc85xx: free MDIO bus if mdio_register fails
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 27 Sep 2021 11:22:04 +0000 (14:22 +0300)
committerRamon Fried <rfried.dev@gmail.com>
Tue, 28 Sep 2021 15:50:57 +0000 (18:50 +0300)
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>
arch/powerpc/cpu/mpc85xx/ether_fcc.c

index 1f6f55707321e9b66bde9ad9437521f7b70a63f9..5cf0a3fb227a2144e7af063b8aa3874ed3938243 100644 (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
        }