Set devs to 0 in case device_get_children return an error. The right thing

to do here is nothing in that case...
This commit is contained in:
imp 2008-08-23 07:46:20 +00:00
parent b06e92ed28
commit 8da6ff44f1
3 changed files with 4 additions and 0 deletions

View File

@ -339,6 +339,7 @@ mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd,
for (i = 0; i < MII_NPHY; i++) {
bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
printf("BMSR(%d) is %#x\n", i, bmsr);
if (bmsr == 0 || bmsr == 0xffff ||
(bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
/* Assume no PHY at this address. */

View File

@ -194,6 +194,7 @@ mlphy_service(xsc, mii, cmd)
* See if there's another PHY on this bus with us.
* If so, we may need it for 10Mbps modes.
*/
devs = 0;
device_get_children(msc->ml_mii.mii_dev, &devlist, &devs);
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "mlphy")) {
@ -400,6 +401,7 @@ mlphy_status(sc)
int devs, i;
/* See if there's another PHY on the bus with us. */
devs = 0;
device_get_children(msc->ml_mii.mii_dev, &devlist, &devs);
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "mlphy")) {

View File

@ -163,6 +163,7 @@ tlphy_attach(device_t dev)
capmask = 0xFFFFFFFF;
if (mii->mii_instance) {
devs = 0;
device_get_children(sc->sc_mii.mii_dev, &devlist, &devs);
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "tlphy")) {