staging: rtl8723bs: convert private allocation functions to return void *

Using char * for a return from allocation functions means the
code has to cast generic allocations to specific types.

Allow the compiler to not need casts on the allocations.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Joe Perches 2017-09-09 13:14:52 -07:00 committed by Greg Kroah-Hartman
parent 67af909404
commit 35628c4ad0
2 changed files with 7 additions and 12 deletions

View file

@ -96,8 +96,8 @@ typedef enum mstat_status{
#define rtw_mstat_update(flag, status, sz) do {} while (0) #define rtw_mstat_update(flag, status, sz) do {} while (0)
#define rtw_mstat_dump(sel) do {} while (0) #define rtw_mstat_dump(sel) do {} while (0)
u8*_rtw_zmalloc(u32 sz); void *_rtw_zmalloc(u32 sz);
u8*_rtw_malloc(u32 sz); void *_rtw_malloc(u32 sz);
void _kfree(u8 *pbuf, u32 sz); void _kfree(u8 *pbuf, u32 sz);
struct sk_buff *_rtw_skb_alloc(u32 sz); struct sk_buff *_rtw_skb_alloc(u32 sz);

View file

@ -30,22 +30,17 @@ inline int RTW_STATUS_CODE(int error_code)
return _FAIL; return _FAIL;
} }
u8 *_rtw_malloc(u32 sz) void *_rtw_malloc(u32 sz)
{ {
u8 *pbuf = NULL; return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
pbuf = kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
return pbuf;
} }
u8 *_rtw_zmalloc(u32 sz) void *_rtw_zmalloc(u32 sz)
{ {
u8 *pbuf = _rtw_malloc(sz); void *pbuf = _rtw_malloc(sz);
if (pbuf != NULL) { if (pbuf)
memset(pbuf, 0, sz); memset(pbuf, 0, sz);
}
return pbuf; return pbuf;
} }