It's just calling kmalloc(, GFP_KERNEL), so call that instead.
A few places should be calling kzalloc(), so do that, and remove the
call to memset at the same time.
Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return buf;
}
-/*----------------------------------------------------------------------------*
- * NAME
- * CsrMemAlloc
- *
- * DESCRIPTION
- * Allocate dynamic memory of a given size.
- *
- * RETURNS
- * Pointer to allocated memory, or NULL in case of failure.
- * Allocated memory is not initialised.
- *
- *----------------------------------------------------------------------------*/
-void *CsrMemAlloc(size_t size)
-{
- return kmalloc(size, GFP_KERNEL);
-}
-EXPORT_SYMBOL_GPL(CsrMemAlloc);
-
/*----------------------------------------------------------------------------*
* NAME
* CsrMemAllocDma
void CsrThreadSleep(u16 sleepTimeInMs);
#ifndef CSR_PMEM_DEBUG_ENABLE
-/*----------------------------------------------------------------------------*
- * NAME
- * CsrMemAlloc
- *
- * DESCRIPTION
- * Allocate dynamic memory of a given size.
- *
- * RETURNS
- * Pointer to allocated memory, or NULL in case of failure.
- * Allocated memory is not initialised.
- *
- *----------------------------------------------------------------------------*/
-#ifdef CSR_MEM_DEBUG
-void *CsrMemAllocDebug(size_t size,
- const char *file, u32 line);
-#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__)
-#else
-void *CsrMemAlloc(size_t size);
-#endif
-
/*----------------------------------------------------------------------------*
* NAME
* CsrMemCalloc
#include "csr_pmem.h"
-#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
-
#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__)
#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
func_enter();
- card = (card_t *)CsrMemAlloc(sizeof(card_t));
+ card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL)
{
return NULL;
}
- memset(card, 0, sizeof(card_t));
-
card->sdio_if = sdio;
card->ospriv = ospriv;
n = cfg_data->num_fromhost_data_slots;
unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n);
- card->from_host_data =
- (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t));
+ card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL);
if (card->from_host_data == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n");
}
/* Allocate memory for the array used for slot host tag mapping */
- card->fh_slot_host_tag_record =
- (u32 *)CsrMemAlloc(n * sizeof(u32));
+ card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL);
if (card->fh_slot_host_tag_record == NULL)
{
n = cfg_data->num_tohost_data_slots;
unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n);
- card->to_host_data =
- (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t));
+ card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL);
if (card->to_host_data == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n");
func_enter();
- fwinfo = CsrMemAlloc(sizeof(xbv1_t));
+ fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
if (fwinfo == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for firmware\n");
unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl);
- fwinfo = CsrMemAlloc(sizeof(xbv1_t));
+ fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
if (fwinfo == NULL)
{
unifi_error(card->ospriv, "Failed to allocate memory for patches\n");
u32 zone_size;
/* Allocate node header */
- newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer));
+ newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL);
if (newnode == NULL)
{
return NULL;
}
- memset(newnode, 0, sizeof(coredump_buffer));
/* Allocate chip memory zone capture buffers */
for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++)
{
zone_size = sizeof(u16) * zonedef_table[i].length;
- newzone = (u16 *)CsrMemAlloc(zone_size);
+ newzone = kzalloc(zone_size, GFP_KERNEL);
newnode->zone[i] = newzone;
- if (newzone != NULL)
- {
- memset(newzone, 0, zone_size);
- }
- else
+ if (newzone == NULL)
{
unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n",
i, zonedef_table[i].length);
}
/* Pre-allocate read buffer for chunk conversion */
- rdbuf = CsrMemAlloc(PTDL_MAX_SIZE);
+ rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL);
if (!rdbuf)
{
unifi_error(card, "Couldn't alloc conversion buffer\n");
*/
patch_buf_size = calc_patch_size(fwinfo);
- patch_buf = (void *)CsrMemAlloc(patch_buf_size);
+ patch_buf = kmalloc(patch_buf_size, GFP_KERNEL);
if (!patch_buf)
{
kfree(rdbuf);
for(i=0; i<size; i++)
{
priv->rxSignalBuffer.rx_buff[i].sig_len=0;
- priv->rxSignalBuffer.rx_buff[i].bufptr = CsrMemAlloc(UNIFI_PACKED_SIGBUF_SIZE);
+ priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL);
if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL)
{
int j;