if (err) 
if (err) 
static int init_phy(struct net_device *dev){	struct gfar_private *priv = netdev_priv(dev);	struct phy_info *curphy;	unsigned int timeout = PHY_INIT_TIMEOUT;	struct gfar *phyregs = priv->phyregs;	struct gfar_mii_info *mii_info;	int err;	priv->oldlink = 0;	priv->oldspeed = 0;	priv->oldduplex = -1;	mii_info = kmalloc(sizeof(struct gfar_mii_info),			GFP_KERNEL);	if(NULL == mii_info) {		printk(KERN_ERR "%s: Could not allocate mii_info\n", 				dev->name);		return -ENOMEM;	}	mii_info->speed = SPEED_1000;	mii_info->duplex = DUPLEX_FULL;	mii_info->pause = 0;	mii_info->link = 1;	mii_info->advertising = (ADVERTISED_10baseT_Half |			ADVERTISED_10baseT_Full |			ADVERTISED_100baseT_Half |			ADVERTISED_100baseT_Full |			ADVERTISED_1000baseT_Full);	mii_info->autoneg = 1;	spin_lock_init(&mii_info->mdio_lock);	mii_info->mii_id = priv->einfo->phyid;	mii_info->dev = dev;	mii_info->mdio_read = &read_phy_reg;	mii_info->mdio_write = &write_phy_reg;	priv->mii_info = mii_info;	/* Reset the management interface */	gfar_write(&phyregs->miimcfg, MIIMCFG_RESET);	/* Setup the MII Mgmt clock speed */	gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE);	/* Wait until the bus is free */	while ((gfar_read(&phyregs->miimind) & MIIMIND_BUSY) &&			timeout--)		cpu_relax();	if(timeout <= 0) {		printk(KERN_ERR "%s: The MII Bus is stuck!\n",				dev->name);		err = -1;		goto bus_fail;	}	/* get info for this PHY */	curphy = get_phy_info(priv->mii_info);	if (curphy == NULL) {		printk(KERN_ERR "%s: No PHY found\n", dev->name);		err = -1;		goto no_phy;	}	mii_info->phyinfo = curphy;	/* Run the commands which initialize the PHY */	if(curphy->init) {		err = curphy->init(priv->mii_info);		if (err) 			goto phy_init_fail;	}	return 0;phy_init_fail:no_phy:bus_fail:	kfree(mii_info);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0bbaf069f053957e8d733784e18a2992afd1dd3c/gianfar.c/buggy/drivers/net/gianfar.c