summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8712/rtl871x_io.c
diff options
context:
space:
mode:
authorVitaly Osipov2014-05-24 10:19:27 +0200
committerGreg Kroah-Hartman2014-05-25 20:04:44 +0200
commit91d435fe368ab30702d7bcd50f680e7185899295 (patch)
tree2415c6d2ad015124be711c82499e0affd6ef89fb /drivers/staging/rtl8712/rtl871x_io.c
parentstaging: slicoss: clean up use of dev_err (diff)
downloadkernel-qcow2-linux-91d435fe368ab30702d7bcd50f680e7185899295.tar.gz
kernel-qcow2-linux-91d435fe368ab30702d7bcd50f680e7185899295.tar.xz
kernel-qcow2-linux-91d435fe368ab30702d7bcd50f680e7185899295.zip
staging: rtl8712: remove _malloc()
This patch removes all usage of _malloc() and the function itself. Most uses are straightforward replacements by kmalloc(..., GFP_ATOMIC), because this was the definition of _malloc(). In a few places it was possible to use kzalloc() or memdup_user. A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL where possible. Verified by compilation only. Initial replacement done by running a Coccinelle script along the lines of: @@ type T; expression E; identifier V; @@ - V = (T) _malloc(E); + V = kmalloc(E, GFP_ATOMIC); @@ expression E, E1; @@ - E1 = _malloc(E); + E1 = kmalloc(E, GFP_ATOMIC); Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8712/rtl871x_io.c')
-rw-r--r--drivers/staging/rtl8712/rtl871x_io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_io.c b/drivers/staging/rtl8712/rtl871x_io.c
index abc1c97378f7..37a841a14889 100644
--- a/drivers/staging/rtl8712/rtl871x_io.c
+++ b/drivers/staging/rtl8712/rtl871x_io.c
@@ -60,8 +60,8 @@ static uint _init_intf_hdl(struct _adapter *padapter,
set_intf_funs = &(r8712_usb_set_intf_funs);
set_intf_ops = &r8712_usb_set_intf_ops;
init_intf_priv = &r8712_usb_init_intf_priv;
- pintf_priv = pintf_hdl->pintfpriv = (struct intf_priv *)
- _malloc(sizeof(struct intf_priv));
+ pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
+ GFP_ATOMIC);
if (pintf_priv == NULL)
goto _init_intf_hdl_fail;
pintf_hdl->adapter = (u8 *)padapter;
@@ -112,15 +112,16 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
struct io_queue *pio_queue;
struct io_req *pio_req;
- pio_queue = (struct io_queue *)_malloc(sizeof(struct io_queue));
+ pio_queue = kmalloc(sizeof(struct io_queue), GFP_ATOMIC);
if (pio_queue == NULL)
goto alloc_io_queue_fail;
_init_listhead(&pio_queue->free_ioreqs);
_init_listhead(&pio_queue->processing);
_init_listhead(&pio_queue->pending);
spin_lock_init(&pio_queue->lock);
- pio_queue->pallocated_free_ioreqs_buf = (u8 *)_malloc(NUM_IOREQ *
- (sizeof(struct io_req)) + 4);
+ pio_queue->pallocated_free_ioreqs_buf = kmalloc(NUM_IOREQ *
+ (sizeof(struct io_req)) + 4,
+ GFP_ATOMIC);
if ((pio_queue->pallocated_free_ioreqs_buf) == NULL)
goto alloc_io_queue_fail;
memset(pio_queue->pallocated_free_ioreqs_buf, 0,