提交 c8f16138 编写于 作者: R Reinette Chatre 提交者: John W. Linville

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: NReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 6e21f15c
...@@ -3405,7 +3405,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3405,7 +3405,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
err = iwl_eeprom_check_version(priv); err = iwl_eeprom_check_version(priv);
if (err) if (err)
goto out_iounmap; goto out_free_eeprom;
/* extract MAC Address */ /* extract MAC Address */
iwl_eeprom_get_mac(priv, priv->mac_addr); 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,6 +3501,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0; return 0;
out_remove_sysfs: out_remove_sysfs:
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
out_free_irq: out_free_irq:
free_irq(priv->pci_dev->irq, priv); free_irq(priv->pci_dev->irq, priv);
......
...@@ -5053,7 +5053,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -5053,7 +5053,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
"invalid queues_num, should be between %d and %d\n", "invalid queues_num, should be between %d and %d\n",
IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES);
err = -EINVAL; err = -EINVAL;
goto out; goto out_ieee80211_free_hw;
} }
/* /*
...@@ -5147,7 +5147,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -5147,7 +5147,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
err = iwl_eeprom_init(priv); err = iwl_eeprom_init(priv);
if (err) { if (err) {
IWL_ERR(priv, "Unable to init EEPROM\n"); IWL_ERR(priv, "Unable to init EEPROM\n");
goto out_remove_sysfs; goto out_iounmap;
} }
/* MAC Address location in EEPROM same for 3945/4965 */ /* MAC Address location in EEPROM same for 3945/4965 */
eeprom = (struct iwl3945_eeprom *)priv->eeprom; 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,7 +5161,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
/* Device-specific setup */ /* Device-specific setup */
if (iwl3945_hw_set_hw_params(priv)) { if (iwl3945_hw_set_hw_params(priv)) {
IWL_ERR(priv, "failed to set hw settings\n"); IWL_ERR(priv, "failed to set hw settings\n");
goto out_iounmap; goto out_eeprom_free;
} }
/*********************** /***********************
...@@ -5171,7 +5171,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -5171,7 +5171,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
err = iwl3945_init_drv(priv); err = iwl3945_init_drv(priv);
if (err) { if (err) {
IWL_ERR(priv, "initializing driver failed\n"); IWL_ERR(priv, "initializing driver failed\n");
goto out_free_geos; goto out_unset_hw_params;
} }
IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", 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,17 +5242,19 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
return 0; return 0;
out_remove_sysfs: out_remove_sysfs:
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
out_free_geos:
iwlcore_free_geos(priv);
out_release_irq: out_release_irq:
free_irq(priv->pci_dev->irq, priv); free_irq(priv->pci_dev->irq, priv);
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
iwl3945_unset_hw_params(priv);
out_disable_msi: out_disable_msi:
pci_disable_msi(priv->pci_dev); pci_disable_msi(priv->pci_dev);
iwlcore_free_geos(priv);
iwl_free_channel_map(priv);
out_unset_hw_params:
iwl3945_unset_hw_params(priv);
out_eeprom_free:
iwl_eeprom_free(priv);
out_iounmap: out_iounmap:
pci_iounmap(pdev, priv->hw_base); pci_iounmap(pdev, priv->hw_base);
out_pci_release_regions: out_pci_release_regions:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册