summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/iwl-drv.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2013-08-13 11:34:55 +0400
committerJohannes Berg <johannes.berg@intel.com>2013-08-16 14:12:03 +0400
commiteafe25e0afaf45a4e38f9b3560ac774a2395c695 (patch)
tree1a8fe594ad32769a6d56ea453690a46c30fdd82b /drivers/net/wireless/iwlwifi/iwl-drv.c
parent3b1995ad83709ac2e1e86c99b37d5ba9ce410f56 (diff)
downloadlinux-eafe25e0afaf45a4e38f9b3560ac774a2395c695.tar.xz
iwlwifi: return -ENOMEM instead of NULL when OOM in iwl_drv_start()
The callers of iwl_drv_start() are probe functions. If a probe function returns 0, it means it succeeded. So if NULL was returned by iwl_drv_start(), it would be considered as a success. Fix this by returning -ENOMEM if the driver struct allocation fails in iwl_drv_start(). 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/iwl-drv.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index e88397bd95eb..99e1da3123c9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1032,8 +1032,10 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans,
int ret;
drv = kzalloc(sizeof(*drv), GFP_KERNEL);
- if (!drv)
- return NULL;
+ if (!drv) {
+ ret = -ENOMEM;
+ goto err;
+ }
drv->trans = trans;
drv->dev = trans->dev;
@@ -1078,7 +1080,7 @@ err_free_dbgfs:
err_free_drv:
#endif
kfree(drv);
-
+err:
return ERR_PTR(ret);
}