Commit bd9dc62c authored by Vitaly Osipov's avatar Vitaly Osipov Committed by Greg Kroah-Hartman

staging: rtl8712: replace kmalloc(..., sizeof(T))

As suggested by Andy Shevchenko on driverdev-devel, replace
v = ... sizeof(struct type_of_v) -> sizeof(*v)

Based on a cocci patch along the lines of

@@
type T;
expression E;
identifier V;
@@

T *V;
...
- V = kmalloc(sizeof(T), E);
+ V = kmalloc(sizeof(*V), E);

@@
type T;
expression E;
identifier V;
@@

T *V;
...
- V = kzalloc(sizeof(T), E);
+ V = kzalloc(sizeof(*V), E);
Signed-off-by: default avatarVitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3ae70746
This diff is collapsed.
......@@ -112,7 +112,7 @@ uint r8712_alloc_io_queue(struct _adapter *adapter)
struct io_queue *pio_queue;
struct io_req *pio_req;
pio_queue = kmalloc(sizeof(struct io_queue), GFP_ATOMIC);
pio_queue = kmalloc(sizeof(*pio_queue), GFP_ATOMIC);
if (pio_queue == NULL)
goto alloc_io_queue_fail;
_init_listhead(&pio_queue->free_ioreqs);
......
......@@ -1212,11 +1212,11 @@ sint r8712_set_auth(struct _adapter *adapter,
struct cmd_obj *pcmd;
struct setauth_parm *psetauthparm;
pcmd = kmalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
psetauthparm = kzalloc(sizeof(struct setauth_parm), GFP_ATOMIC);
psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC);
if (psetauthparm == NULL) {
kfree((unsigned char *)pcmd);
return _FAIL;
......@@ -1242,10 +1242,10 @@ sint r8712_set_key(struct _adapter *adapter,
u8 keylen;
sint ret = _SUCCESS;
pcmd = kmalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (pcmd == NULL)
return _FAIL;
psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_ATOMIC);
psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC);
if (psetkeyparm == NULL) {
ret = _FAIL;
goto err_free_cmd;
......
......@@ -281,10 +281,10 @@ void r8712_SetChannel(struct _adapter *pAdapter)
struct SetChannel_parm *pparm = NULL;
u16 code = GEN_CMD_CODE(_SetChannel);
pcmd = kmalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (pcmd == NULL)
return;
pparm = kmalloc(sizeof(struct SetChannel_parm), GFP_ATOMIC);
pparm = kmalloc(sizeof(*pparm), GFP_ATOMIC);
if (pparm == NULL) {
kfree(pcmd);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment