fix lockup in mcfmii/mii_discover_phy() in case communication fails

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
Wolfgang Wegner 2010-04-06 11:13:02 +02:00 committed by Ben Warren
parent 23c34af48f
commit 33f684d6d5

View file

@ -175,7 +175,8 @@ int mii_discover_phy(struct eth_device *dev)
#ifdef ET_DEBUG
printf("PHY type 0x%x pass %d type\n", phytype, pass);
#endif
if (phytype != 0xffff) {
if (phytype == 0xffff)
continue;
phyaddr = phyno;
phytype <<= 16;
phytype |=
@ -185,7 +186,8 @@ 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",
@ -209,7 +211,6 @@ int mii_discover_phy(struct eth_device *dev)
}
}
}
}
if (phyaddr < 0)
printf("No PHY device found.\n");