mwifiex: fix null derefs, mem leaks and trivia
This patch:
- adds kfree() where necessary
- prevents potential null dereferences
- makes use of kfree_skb()
- replaces -1 for failed kzallocs with -ENOMEM
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Kiran Divekar <dkiran@marvell.com>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index 27ad72b..6a8fd99 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -41,7 +41,7 @@
if (!bss_prio) {
dev_err(adapter->dev, "%s: failed to alloc bss_prio\n",
__func__);
- return -1;
+ return -ENOMEM;
}
bss_prio->priv = priv;
@@ -161,7 +161,7 @@
if (!temp_scan_table) {
dev_err(adapter->dev, "%s: failed to alloc temp_scan_table\n",
__func__);
- return -1;
+ return -ENOMEM;
}
adapter->scan_table = temp_scan_table;