Skip to content

Commit

Permalink
staging: wilc1000: linux_mon: fix error code of kmalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chaehyun Lim authored and Greg Kroah-Hartman committed Feb 3, 2016
1 parent fa61127 commit b026f6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/wilc1000/linux_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b026f6e

Please sign in to comment.