Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 623d563e authored by Reinette Chatre's avatar Reinette Chatre Committed by John W. Linville
Browse files

iwlwifi: fix error flow in iwl*_pci_probe



Both the agn and 3945 drivers has some problems with dealing with
errors in their probe functions. Ensure that a goto will undo only
things that was done before the goto was called.

Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ef4bb70d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3868,7 +3868,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	}
	err = iwl_eeprom_check_version(priv);
	if (err)
		goto out_iounmap;
		goto out_free_eeprom;

	/* extract MAC Address */
	iwl_eeprom_get_mac(priv, priv->mac_addr);
@@ -3945,6 +3945,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	return 0;

 out_remove_sysfs:
	destroy_workqueue(priv->workqueue);
	priv->workqueue = NULL;
	sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
 out_uninit_drv:
	iwl_uninit_drv(priv);
@@ -3953,8 +3955,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 out_iounmap:
	pci_iounmap(pdev, priv->hw_base);
 out_pci_release_regions:
	pci_release_regions(pdev);
	pci_set_drvdata(pdev, NULL);
	pci_release_regions(pdev);
 out_pci_disable_device:
	pci_disable_device(pdev);
 out_ieee80211_free_hw:
+7 −10
Original line number Diff line number Diff line
@@ -7911,7 +7911,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
				CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
	if (err < 0) {
		IWL_DEBUG_INFO("Failed to init the card\n");
		goto out_remove_sysfs;
		goto out_iounmap;
	}

	/***********************
@@ -7921,7 +7921,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
	err = iwl3945_eeprom_init(priv);
	if (err) {
		IWL_ERROR("Unable to init EEPROM\n");
		goto out_remove_sysfs;
		goto out_iounmap;
	}
	/* MAC Address location in EEPROM same for 3945/4965 */
	get_eeprom_mac(priv, priv->mac_addr);
@@ -7975,7 +7975,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
	err = iwl3945_init_channel_map(priv);
	if (err) {
		IWL_ERROR("initializing regulatory failed: %d\n", err);
		goto out_release_irq;
		goto out_unset_hw_setting;
	}

	err = iwl3945_init_geos(priv);
@@ -8045,25 +8045,22 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
	return 0;

 out_remove_sysfs:
	destroy_workqueue(priv->workqueue);
	priv->workqueue = NULL;
	sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
 out_free_geos:
	iwl3945_free_geos(priv);
 out_free_channel_map:
	iwl3945_free_channel_map(priv);


 out_release_irq:
	destroy_workqueue(priv->workqueue);
	priv->workqueue = NULL;
 out_unset_hw_setting:
	iwl3945_unset_hw_setting(priv);

 out_iounmap:
	pci_iounmap(pdev, priv->hw_base);
 out_pci_release_regions:
	pci_release_regions(pdev);
 out_pci_disable_device:
	pci_disable_device(pdev);
	pci_set_drvdata(pdev, NULL);
	pci_disable_device(pdev);
 out_ieee80211_free_hw:
	ieee80211_free_hw(priv->hw);
 out: