diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2009-02-27 19:21:22 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-05 14:39:36 -0500 |
commit | c8f16138b5099bfd928942c3775aaecfd649e9e5 (patch) | |
tree | 817739aede583a0c784c2c7794ab9dae3c24ff48 /drivers/net/wireless/iwlwifi | |
parent | 6e21f15cac2c6c25b6a5874a98420e1b9064f0c1 (diff) |
iwlwifi: fix *pci_probe error flow
for iwlagn:
- Have to free eeprom of version check fails - otherwise we end up with
memory leak.
- Include removal of workqueue (created in _setup_deferred_work) in error
handling.
for iwl3945:
- Fix a few places to jump to correct error handling.
- Reorganize error handling to match with code flow.
- Include iwl_free_channel_map as part of error handling.
- Include releasing eeprom as part of error handling.
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 22 |
2 files changed, 15 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b49f9f7a8a67..18f6f6807565 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3405,7 +3405,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3405 | } | 3405 | } |
3406 | err = iwl_eeprom_check_version(priv); | 3406 | err = iwl_eeprom_check_version(priv); |
3407 | if (err) | 3407 | if (err) |
3408 | goto out_iounmap; | 3408 | goto out_free_eeprom; |
3409 | 3409 | ||
3410 | /* extract MAC Address */ | 3410 | /* extract MAC Address */ |
3411 | iwl_eeprom_get_mac(priv, priv->mac_addr); | 3411 | iwl_eeprom_get_mac(priv, priv->mac_addr); |
@@ -3501,6 +3501,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3501 | return 0; | 3501 | return 0; |
3502 | 3502 | ||
3503 | out_remove_sysfs: | 3503 | out_remove_sysfs: |
3504 | destroy_workqueue(priv->workqueue); | ||
3505 | priv->workqueue = NULL; | ||
3504 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); | 3506 | sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); |
3505 | out_free_irq: | 3507 | out_free_irq: |
3506 | free_irq(priv->pci_dev->irq, priv); | 3508 | free_irq(priv->pci_dev->irq, priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 96672b691946..2d47e9a8c329 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -5053,7 +5053,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5053 | "invalid queues_num, should be between %d and %d\n", | 5053 | "invalid queues_num, should be between %d and %d\n", |
5054 | IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); | 5054 | IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); |
5055 | err = -EINVAL; | 5055 | err = -EINVAL; |
5056 | goto out; | 5056 | goto out_ieee80211_free_hw; |
5057 | } | 5057 | } |
5058 | 5058 | ||
5059 | /* | 5059 | /* |
@@ -5147,7 +5147,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5147 | err = iwl_eeprom_init(priv); | 5147 | err = iwl_eeprom_init(priv); |
5148 | if (err) { | 5148 | if (err) { |
5149 | IWL_ERR(priv, "Unable to init EEPROM\n"); | 5149 | IWL_ERR(priv, "Unable to init EEPROM\n"); |
5150 | goto out_remove_sysfs; | 5150 | goto out_iounmap; |
5151 | } | 5151 | } |
5152 | /* MAC Address location in EEPROM same for 3945/4965 */ | 5152 | /* MAC Address location in EEPROM same for 3945/4965 */ |
5153 | eeprom = (struct iwl3945_eeprom *)priv->eeprom; | 5153 | eeprom = (struct iwl3945_eeprom *)priv->eeprom; |
@@ -5161,7 +5161,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5161 | /* Device-specific setup */ | 5161 | /* Device-specific setup */ |
5162 | if (iwl3945_hw_set_hw_params(priv)) { | 5162 | if (iwl3945_hw_set_hw_params(priv)) { |
5163 | IWL_ERR(priv, "failed to set hw settings\n"); | 5163 | IWL_ERR(priv, "failed to set hw settings\n"); |
5164 | goto out_iounmap; | 5164 | goto out_eeprom_free; |
5165 | } | 5165 | } |
5166 | 5166 | ||
5167 | /*********************** | 5167 | /*********************** |
@@ -5171,7 +5171,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5171 | err = iwl3945_init_drv(priv); | 5171 | err = iwl3945_init_drv(priv); |
5172 | if (err) { | 5172 | if (err) { |
5173 | IWL_ERR(priv, "initializing driver failed\n"); | 5173 | IWL_ERR(priv, "initializing driver failed\n"); |
5174 | goto out_free_geos; | 5174 | goto out_unset_hw_params; |
5175 | } | 5175 | } |
5176 | 5176 | ||
5177 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", | 5177 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", |
@@ -5242,17 +5242,19 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5242 | return 0; | 5242 | return 0; |
5243 | 5243 | ||
5244 | out_remove_sysfs: | 5244 | out_remove_sysfs: |
5245 | destroy_workqueue(priv->workqueue); | ||
5246 | priv->workqueue = NULL; | ||
5245 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | 5247 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); |
5246 | out_free_geos: | ||
5247 | iwlcore_free_geos(priv); | ||
5248 | |||
5249 | out_release_irq: | 5248 | out_release_irq: |
5250 | free_irq(priv->pci_dev->irq, priv); | 5249 | free_irq(priv->pci_dev->irq, priv); |
5251 | destroy_workqueue(priv->workqueue); | ||
5252 | priv->workqueue = NULL; | ||
5253 | iwl3945_unset_hw_params(priv); | ||
5254 | out_disable_msi: | 5250 | out_disable_msi: |
5255 | pci_disable_msi(priv->pci_dev); | 5251 | pci_disable_msi(priv->pci_dev); |
5252 | iwlcore_free_geos(priv); | ||
5253 | iwl_free_channel_map(priv); | ||
5254 | out_unset_hw_params: | ||
5255 | iwl3945_unset_hw_params(priv); | ||
5256 | out_eeprom_free: | ||
5257 | iwl_eeprom_free(priv); | ||
5256 | out_iounmap: | 5258 | out_iounmap: |
5257 | pci_iounmap(pdev, priv->hw_base); | 5259 | pci_iounmap(pdev, priv->hw_base); |
5258 | out_pci_release_regions: | 5260 | out_pci_release_regions: |