err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); if (err == -EIO) { /* Try workaround for old Symbol firmware bug */ printk(KERN_WARNING "%s: firmware ALLOC bug detected " "(old Symbol firmware?). Trying to work around... ", dev->name);  priv->nicbuf_size = TX_NICBUF_SIZE_BUG; err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); if (err) printk("failed!\n"); else printk("ok.\n"); } if (err) { printk("%s: Error %d allocating Tx buffer\n", dev->name, err); goto out; }  
static int orinoco_init(struct net_device *dev){	struct orinoco_private *priv = netdev_priv(dev);	hermes_t *hw = &priv->hw;	int err = 0;	struct hermes_idstring nickbuf;	u16 reclen;	int len;	TRACE_ENTER(dev->name);	/* No need to lock, the hw_unavailable flag is already set in	 * alloc_orinocodev() */	priv->nicbuf_size = IEEE802_11_FRAME_LEN + ETH_HLEN;	/* Initialize the firmware */	err = hermes_init(hw);	if (err != 0) {		printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n",		       dev->name, err);		goto out;	}	err = determine_firmware(dev);	if (err != 0) {		printk(KERN_ERR "%s: Incompatible firmware, aborting\n",		       dev->name);		goto out;	}	if (priv->has_port3)		printk(KERN_DEBUG "%s: Ad-hoc demo mode supported\n", dev->name);	if (priv->has_ibss)		printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported\n",		       dev->name);	if (priv->has_wep) {		printk(KERN_DEBUG "%s: WEP supported, ", dev->name);		if (priv->has_big_wep)			printk("104-bit key\n");		else			printk("40-bit key\n");	}	/* Get the MAC address */	err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,			      ETH_ALEN, NULL, dev->dev_addr);	if (err) {		printk(KERN_WARNING "%s: failed to read MAC address!\n",		       dev->name);		goto out;	}	printk(KERN_DEBUG "%s: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",	       dev->name, dev->dev_addr[0], dev->dev_addr[1],	       dev->dev_addr[2], dev->dev_addr[3], dev->dev_addr[4],	       dev->dev_addr[5]);	/* Get the station name */	err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,			      sizeof(nickbuf), &reclen, &nickbuf);	if (err) {		printk(KERN_ERR "%s: failed to read station name\n",		       dev->name);		goto out;	}	if (nickbuf.len)		len = min(IW_ESSID_MAX_SIZE, (int)le16_to_cpu(nickbuf.len));	else		len = min(IW_ESSID_MAX_SIZE, 2 * reclen);	memcpy(priv->nick, &nickbuf.val, len);	priv->nick[len] = '\0';	printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);	/* Get allowed channels */	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST,				  &priv->channel_mask);	if (err) {		printk(KERN_ERR "%s: failed to read channel list!\n",		       dev->name);		goto out;	}	/* Get initial AP density */	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE,				  &priv->ap_density);	if (err || priv->ap_density < 1 || priv->ap_density > 3) {		priv->has_sensitivity = 0;	}	/* Get initial RTS threshold */	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,				  &priv->rts_thresh);	if (err) {		printk(KERN_ERR "%s: failed to read RTS threshold!\n",		       dev->name);		goto out;	}	/* Get initial fragmentation settings */	if (priv->has_mwo)		err = hermes_read_wordrec(hw, USER_BAP,					  HERMES_RID_CNFMWOROBUST_AGERE,					  &priv->mwo_robust);	else		err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,					  &priv->frag_thresh);	if (err) {		printk(KERN_ERR "%s: failed to read fragmentation settings!\n",		       dev->name);		goto out;	}	/* Power management setup */	if (priv->has_pm) {		priv->pm_on = 0;		priv->pm_mcast = 1;		err = hermes_read_wordrec(hw, USER_BAP,					  HERMES_RID_CNFMAXSLEEPDURATION,					  &priv->pm_period);		if (err) {			printk(KERN_ERR "%s: failed to read power management period!\n",			       dev->name);			goto out;		}		err = hermes_read_wordrec(hw, USER_BAP,					  HERMES_RID_CNFPMHOLDOVERDURATION,					  &priv->pm_timeout);		if (err) {			printk(KERN_ERR "%s: failed to read power management timeout!\n",			       dev->name);			goto out;		}	}	/* Preamble setup */	if (priv->has_preamble) {		err = hermes_read_wordrec(hw, USER_BAP,					  HERMES_RID_CNFPREAMBLE_SYMBOL,					  &priv->preamble);		if (err)			goto out;	}			/* Set up the default configuration */	priv->iw_mode = IW_MODE_INFRA;	/* By default use IEEE/IBSS ad-hoc mode if we have it */	priv->prefer_port3 = priv->has_port3 && (! priv->has_ibss);	set_port_type(priv);	priv->channel = 0; /* use firmware default */	priv->promiscuous = 0;	priv->wep_on = 0;	priv->tx_key = 0;	err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);	if (err == -EIO) {		/* Try workaround for old Symbol firmware bug */		printk(KERN_WARNING "%s: firmware ALLOC bug detected "		       "(old Symbol firmware?). Trying to work around... ",		       dev->name);				priv->nicbuf_size = TX_NICBUF_SIZE_BUG;		err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);		if (err)			printk("failed!\n");		else			printk("ok.\n");	}	if (err) {		printk("%s: Error %d allocating Tx buffer\n", dev->name, err);		goto out;	}	/* Make the hardware available, as long as it hasn't been	 * removed elsewhere (e.g. by PCMCIA hot unplug) */	spin_lock_irq(&priv->lock);	priv->hw_unavailable--;	spin_unlock_irq(&priv->lock);	printk(KERN_DEBUG "%s: ready\n", dev->name); out:	TRACE_EXIT(dev->name);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b24d4582fd93f3654d0a0a89f85e95140efc7fd4/orinoco.c/buggy/drivers/net/wireless/orinoco.c