staging: wilc1000: linux_mon: fix error code of kmalloc
authorChaehyun Lim <chaehyun.lim@gmail.com>
Mon, 1 Feb 2016 12:26:46 +0000 (21:26 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 23:34:29 +0000 (15:34 -0800)
This patch fixes error codes as -ENOMEM instead of using -EFAULT if
kmalloc is failed.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_mon.c

index a19755e..1443a23 100644 (file)
@@ -166,14 +166,14 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
        mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_ATOMIC);
        if (!mgmt_tx) {
                PRINT_ER("Failed to allocate memory for mgmt_tx structure\n");
-               return -EFAULT;
+               return -ENOMEM;
        }
 
        mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
        if (!mgmt_tx->buff) {
                PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
                kfree(mgmt_tx);
-               return -EFAULT;
+               return -ENOMEM;
        }
 
        mgmt_tx->size = len;