----------------------------
  
 +What:         PCI DMA unmap state API
 +When: August 2012
 +Why:  PCI DMA unmap state API (include/linux/pci-dma.h) was replaced
 +      with DMA unmap state API (DMA unmap state API can be used for
 +      any bus).
 +Who:  FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
 +
 +----------------------------
 +
 +What:         DMA_xxBIT_MASK macros
 +When: Jun 2011
 +Why:  DMA_xxBIT_MASK macros were replaced with DMA_BIT_MASK() macros.
 +Who:  FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
 +
 +----------------------------
 +
+ What: iwlwifi disable_hw_scan module parameters
+ When: 2.6.40
+ Why:  Hareware scan is the prefer method for iwlwifi devices for
+       scanning operation. Remove software scan support for all the
+       iwlwifi devices.
+ 
+ Who:  Wey-Yi Guy <wey-yi.w.guy@intel.com>
+ 
+ ----------------------------
 
  
                bg_band->band = IEEE80211_BAND_2GHZ;
                bg_band->n_channels = geo->bg_channels;
 -              bg_band->channels =
 -                      kzalloc(geo->bg_channels *
 -                              sizeof(struct ieee80211_channel), GFP_KERNEL);
 +              bg_band->channels = kcalloc(geo->bg_channels,
 +                                          sizeof(struct ieee80211_channel),
 +                                          GFP_KERNEL);
+               if (!bg_band->channels) {
+                       rc = -ENOMEM;
+                       goto out;
+               }
                /* translate geo->bg to bg_band.channels */
                for (i = 0; i < geo->bg_channels; i++) {
                        bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
  
                a_band->band = IEEE80211_BAND_5GHZ;
                a_band->n_channels = geo->a_channels;
 -              a_band->channels =
 -                      kzalloc(geo->a_channels *
 -                              sizeof(struct ieee80211_channel), GFP_KERNEL);
 +              a_band->channels = kcalloc(geo->a_channels,
 +                                         sizeof(struct ieee80211_channel),
 +                                         GFP_KERNEL);
+               if (!a_band->channels) {
+                       rc = -ENOMEM;
+                       goto out;
+               }
                /* translate geo->bg to a_band.channels */
                for (i = 0; i < geo->a_channels; i++) {
                        a_band->channels[i].band = IEEE80211_BAND_2GHZ;
 
  
        wl->scan.req = req;
  
 -      wl->scan.scanned_ch = kzalloc(req->n_channels *
 +      wl->scan.scanned_ch = kcalloc(req->n_channels,
                                      sizeof(*wl->scan.scanned_ch),
                                      GFP_KERNEL);
+       /* we assume failure so that timeout scenarios are handled correctly */
+       wl->scan.failed = true;
+       ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work,
+                                    msecs_to_jiffies(WL1271_SCAN_TIMEOUT));
+ 
        wl1271_scan_stm(wl);
  
        return 0;