[U-Boot] [PATCH] fix lockup in mcfmii/mii_discover_phy() in case communication fails

Wolfgang Wegner w.wegner at astro-kom.de
Tue Mar 30 19:19:49 CEST 2010


Signed-off-by: Wolfgang Wegner <w.wegner at astro-kom.de>
---
 drivers/net/mcfmii.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index 4acc29e..83c0873 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -185,7 +185,11 @@ int mii_discover_phy(struct eth_device *dev)
 				printf("PHY @ 0x%x pass %d\n", phyno, pass);
 #endif
 
-				for (i = 0; i < (sizeof(phyinfo) / sizeof(phy_info_t)); i++) {
+				for (i = 0;
+					(i < (sizeof(phyinfo)
+						/ sizeof(phy_info_t)))
+					&& (phyinfo[i].phyid != 0);
+					i++) {
 					if (phyinfo[i].phyid == phytype) {
 #ifdef ET_DEBUG
 						printf("phyid %x - %s\n",
-- 
1.5.6.5



More information about the U-Boot mailing list