···251251 return;252252 pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len,253253 PCI_DMA_TODEVICE);254254- dev_kfree_skb(bf->skb);254254+ dev_kfree_skb_any(bf->skb);255255 bf->skb = NULL;256256}257257···466466 mutex_init(&sc->lock);467467 spin_lock_init(&sc->rxbuflock);468468 spin_lock_init(&sc->txbuflock);469469+ spin_lock_init(&sc->block);469470470471 /* Set private data */471472 pci_set_drvdata(pdev, hw);···2180217921812180 sc->imask |= AR5K_INT_SWBA;2182218121832183- if (ath5k_hw_hasveol(ah))21822182+ if (ath5k_hw_hasveol(ah)) {21832183+ spin_lock(&sc->block);21842184 ath5k_beacon_send(sc);21852185+ spin_unlock(&sc->block);21862186+ }21852187 }21862188 /* TODO else AP */21872189···24072403 TSF_TO_TU(tsf),24082404 (unsigned long long) tsf);24092405 } else {24062406+ spin_lock(&sc->block);24102407 ath5k_beacon_send(sc);24082408+ spin_unlock(&sc->block);24112409 }24122410 }24132411 if (status & AR5K_INT_RXEOL) {···27512745 ret = -EOPNOTSUPP;27522746 goto end;27532747 }27482748+27492749+ /* Set to a reasonable value. Note that this will27502750+ * be set to mac80211's value at ath5k_config(). */27512751+ sc->bintval = 1000;27522752+27542753 ret = 0;27552754end:27562755 mutex_unlock(&sc->lock);···28002789 struct ath5k_hw *ah = sc->ah;28012790 int ret;2802279128032803- /* Set to a reasonable value. Note that this will28042804- * be set to mac80211's value at ath5k_config(). */28052805- sc->bintval = 1000;28062792 mutex_lock(&sc->lock);28072793 if (sc->vif != vif) {28082794 ret = -EIO;···30583050ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)30593051{30603052 struct ath5k_softc *sc = hw->priv;30533053+ unsigned long flags;30613054 int ret;3062305530633056 ath5k_debug_dump_skb(sc, skb, "BC ", 1);···30683059 goto end;30693060 }3070306130623062+ spin_lock_irqsave(&sc->block, flags);30713063 ath5k_txbuf_free(sc, sc->bbuf);30723064 sc->bbuf->skb = skb;30733065 ret = ath5k_beacon_setup(sc, sc->bbuf);30743066 if (ret)30753067 sc->bbuf->skb = NULL;30763076- else {30683068+ spin_unlock_irqrestore(&sc->block, flags);30693069+ if (!ret) {30773070 ath5k_beacon_config(sc);30783071 mmiowb();30793072 }
···13041304int atmel_open(struct net_device *dev)13051305{13061306 struct atmel_private *priv = netdev_priv(dev);13071307- int i, channel;13071307+ int i, channel, err;1308130813091309 /* any scheduled timer is no longer needed and might screw things up.. */13101310 del_timer_sync(&priv->management_timer);···13281328 priv->site_survey_state = SITE_SURVEY_IDLE;13291329 priv->station_is_associated = 0;1330133013311331- if (!reset_atmel_card(dev))13321332- return -EAGAIN;13311331+ err = reset_atmel_card(dev);13321332+ if (err)13331333+ return err;1333133413341335 if (priv->config_reg_domain) {13351336 priv->reg_domain = priv->config_reg_domain;···30623061 }3063306230643063 if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {30653065- /* Do opensystem first, then try sharedkey */30643064+ /* Flip back and forth between WEP auth modes until the max30653065+ * authentication tries has been exceeded.30663066+ */30663067 if (system == WLAN_AUTH_OPEN) {30673068 priv->CurrentAuthentTransactionSeqNum = 0x001;30683069 priv->exclude_unencrypted = 1;30693070 send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0);30713071+ return;30723072+ } else if ( system == WLAN_AUTH_SHARED_KEY30733073+ && priv->wep_is_on) {30743074+ priv->CurrentAuthentTransactionSeqNum = 0x001;30753075+ priv->exclude_unencrypted = 0;30763076+ send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0);30703077 return;30713078 } else if (priv->connect_to_any_BSS) {30723079 int bss_index;···3589358035903581 if (i == 0) {35913582 printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name);35923592- return 0;35833583+ return -EIO;35933584 }3594358535953586 if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) {35963587 printk(KERN_ALERT "%s: card missing.\n", priv->dev->name);35973597- return 0;35883588+ return -ENODEV;35983589 }3599359036003591 /* now check for completion of MAC initialization through···36183609 if (i == 0) {36193610 printk(KERN_ALERT "%s: MAC failed to initialise.\n",36203611 priv->dev->name);36213621- return 0;36123612+ return -EIO;36223613 }3623361436243615 /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */36253616 if ((mr3 & MAC_INIT_COMPLETE) &&36263617 !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) {36273618 printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name);36283628- return 0;36193619+ return -EIO;36293620 }36303621 if ((mr1 & MAC_INIT_COMPLETE) &&36313622 !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) {36323623 printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name);36333633- return 0;36243624+ return -EIO;36343625 }3635362636363627 atmel_copy_to_host(priv->dev, (unsigned char *)iface,···36513642 iface->func_ctrl = le16_to_cpu(iface->func_ctrl);36523643 iface->mac_status = le16_to_cpu(iface->mac_status);3653364436543654- return 1;36453645+ return 0;36553646}3656364736573648/* determine type of memory and MAC address */···37023693 /* Standard firmware in flash, boot it up and ask37033694 for the Mac Address */37043695 priv->card_type = CARD_TYPE_SPI_FLASH;37053705- if (atmel_wakeup_firmware(priv)) {36963696+ if (atmel_wakeup_firmware(priv) == 0) {37063697 atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6);3707369837083699 /* got address, now squash it again until the network···38443835 struct atmel_private *priv = netdev_priv(dev);38453836 u8 configuration;38463837 int old_state = priv->station_state;38383838+ int err = 0;3847383938483840 /* data to add to the firmware names, in priority order38493841 this implemenents firmware versioning */···38783868 dev->name);38793869 strcpy(priv->firmware_id, "atmel_at76c502.bin");38803870 }38813881- if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) != 0) {38713871+ err = request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev);38723872+ if (err != 0) {38823873 printk(KERN_ALERT38833874 "%s: firmware %s is missing, cannot continue.\n",38843875 dev->name, priv->firmware_id);38853885- return 0;38763876+ return err;38863877 }38873878 } else {38883879 int fw_index = 0;···39123901 "%s: firmware %s is missing, cannot start.\n",39133902 dev->name, priv->firmware_id);39143903 priv->firmware_id[0] = '\0';39153915- return 0;39043904+ return -ENOENT;39163905 }39173906 }39183907···39373926 release_firmware(fw_entry);39383927 }3939392839403940- if (!atmel_wakeup_firmware(priv))39413941- return 0;39293929+ err = atmel_wakeup_firmware(priv);39303930+ if (err != 0)39313931+ return err;3942393239433933 /* Check the version and set the correct flag for wpa stuff,39443934 old and new firmware is incompatible.···39803968 if (!priv->radio_on_broken) {39813969 if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) ==39823970 CMD_STATUS_REJECTED_RADIO_OFF) {39833983- printk(KERN_INFO39843984- "%s: cannot turn the radio on. (Hey radio, you're beautiful!)\n",39713971+ printk(KERN_INFO "%s: cannot turn the radio on.\n",39853972 dev->name);39863986- return 0;39733973+ return -EIO;39873974 }39883975 }39893976···40174006 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);40184007 }4019400840204020- return 1;40094009+ return 0;40214010}4022401140234012static void atmel_send_command(struct atmel_private *priv, int command,