diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-01-09 21:26:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-13 15:46:44 -0500 |
commit | 35b3ac470b982ded560e1b2ec9206a8d186c3459 (patch) | |
tree | 86c767eb3574447c4a318831d9cd1e021a4f1d73 /drivers/net/wireless/iwmc3200wifi | |
parent | 4e5518ca53be29c1ec3c00089c97bef36bfed515 (diff) |
iwmc3200wifi: Return proper error for iwm_if_alloc
In the case of alloc_netdev_mq failure and kmalloc failure,
current implementation returns ERR_PTR(0).
As a result, the caller of iwm_if_alloc does not catch the error by IS_ERR
macro. Fix it by setting proper error code for ret variable in the failure
cases.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi')
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/netdev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index 13a69ebf2a94..5091d77e02ce 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c | |||
@@ -126,6 +126,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, | |||
126 | ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); | 126 | ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); |
127 | if (!ndev) { | 127 | if (!ndev) { |
128 | dev_err(dev, "no memory for network device instance\n"); | 128 | dev_err(dev, "no memory for network device instance\n"); |
129 | ret = -ENOMEM; | ||
129 | goto out_priv; | 130 | goto out_priv; |
130 | } | 131 | } |
131 | 132 | ||
@@ -138,6 +139,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, | |||
138 | GFP_KERNEL); | 139 | GFP_KERNEL); |
139 | if (!iwm->umac_profile) { | 140 | if (!iwm->umac_profile) { |
140 | dev_err(dev, "Couldn't alloc memory for profile\n"); | 141 | dev_err(dev, "Couldn't alloc memory for profile\n"); |
142 | ret = -ENOMEM; | ||
141 | goto out_profile; | 143 | goto out_profile; |
142 | } | 144 | } |
143 | 145 | ||