iwlwifi: fix spinlock used before initialized
authorRon Rindjunsky <ron.rindjunsky@intel.com>
Mon, 5 May 2008 02:22:51 +0000 (10:22 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 May 2008 20:29:47 +0000 (16:29 -0400)
The patch fixes spinlock priv->lock (apm_ops.init) is used before it has
been initialized.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-core.c

index 126ecf7023ebc624be4180b8ba3a160cf2ddf639..0b4413830507da7cdc1fa81563b01c4146581ee1 100644 (file)
@@ -489,10 +489,8 @@ static int iwl4965_disable_tx_fifo(struct iwl_priv *priv)
 
 static int iwl4965_apm_init(struct iwl_priv *priv)
 {
-       unsigned long flags;
        int ret = 0;
 
-       spin_lock_irqsave(&priv->lock, flags);
        iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
                          CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
 
@@ -524,7 +522,6 @@ static int iwl4965_apm_init(struct iwl_priv *priv)
 
        iwl_release_nic_access(priv);
 out:
-       spin_unlock_irqrestore(&priv->lock, flags);
        return ret;
 }
 
index aab0ee6d8af49b036d6126c21ac50d21fb4a58e8..7759e63b2bcfe7a0ffc70b508764538bbf05b048 100644 (file)
@@ -174,9 +174,8 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
        int ret;
 
        /* nic_init */
-       priv->cfg->ops->lib->apm_ops.init(priv);
-
        spin_lock_irqsave(&priv->lock, flags);
+       priv->cfg->ops->lib->apm_ops.init(priv);
        iwl_write32(priv, CSR_INT_COALESCING, 512 / 32);
        spin_unlock_irqrestore(&priv->lock, flags);