summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/pcie/drv.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2013-08-10 16:35:45 +0300
committerJohannes Berg <johannes.berg@intel.com>2013-08-12 15:20:29 +0200
commit6965a3540a4b45ee5b6fa91276a8134e25e17b63 (patch)
treeb82db7e6f1337b1e71d1cdebf2bb930d20a7b33a /drivers/net/wireless/iwlwifi/pcie/drv.c
parentf8f03c3edc39f179457a4a5c6095f45a8300db9b (diff)
iwlwifi: pcie: don't swallow error codes in iwl_trans_pcie_alloc()
The iwl_trans_pcie_alloc() function doesn't pass up error codes returned from functions it calls, swallowing them and returning NULL in all failure cases. The caller checks if the return value is NULL and returns -ENOMEM. This is not correct, because in certain cases the failure was not due to an OOM situation. To fix this, modify the iwl_trans_pcie_alloc() function to use ERR_PTR() to return error codes and clean up the error handling code a bit. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/pcie/drv.c')
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 9ec8dfeb4354..e179efeddc8d 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -324,8 +324,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int ret;
iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg);
- if (iwl_trans == NULL)
- return -ENOMEM;
+ if (IS_ERR(iwl_trans))
+ return PTR_ERR(iwl_trans);
pci_set_drvdata(pdev, iwl_trans);