[PATCH 5/5] ath6kl: Convert A_MALLOC to kmalloc/kzalloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there's a memset or an A_MEMZERO, use kzalloc.

Cc: Vipin Mehta <vmehta@xxxxxxxxxxx>
Cc: Naveen Singh <naveen.singh@xxxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
---
 .../ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c   |   16 +++------
 drivers/staging/ath6kl/htc2/AR6000/ar6k.c          |    2 +-
 .../ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c        |    3 +-
 drivers/staging/ath6kl/htc2/htc.c                  |    7 ++--
 drivers/staging/ath6kl/miscdrv/ar3kconfig.c        |    9 ++---
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c   |    8 ++--
 .../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c   |   39 +++++++++-----------
 drivers/staging/ath6kl/os/linux/ar6000_raw_if.c    |    9 ++---
 drivers/staging/ath6kl/os/linux/ar6k_pal.c         |    5 +--
 drivers/staging/ath6kl/os/linux/hci_bridge.c       |    9 ++---
 drivers/staging/ath6kl/os/linux/ioctl.c            |   17 +++++----
 drivers/staging/ath6kl/reorder/rcv_aggr.c          |    6 +--
 drivers/staging/ath6kl/wmi/wmi.c                   |    7 +---
 13 files changed, 55 insertions(+), 82 deletions(-)

diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
index 06f79b8..886bd24 100644
--- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
+++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c
@@ -328,24 +328,18 @@ int SetupHIFScatterSupport(HIF_DEVICE * device,
 
 		for (i = 0; i < MAX_SCATTER_REQUESTS; i++) {
 			/* allocate the private request blob */
-			pReqPriv =
-			    (HIF_SCATTER_REQ_PRIV *)
-			    A_MALLOC(sizeof(HIF_SCATTER_REQ_PRIV));
+			pReqPriv = kzalloc(sizeof(HIF_SCATTER_REQ_PRIV),
+					   GFP_KERNEL);
 			if (NULL == pReqPriv) {
 				break;
 			}
-			A_MEMZERO(pReqPriv, sizeof(HIF_SCATTER_REQ_PRIV));
 			/* save the device instance */
 			pReqPriv->device = device;
 			/* allocate the scatter request */
 			pReqPriv->pHifScatterReq =
-			    (HIF_SCATTER_REQ *) A_MALLOC(sizeof(HIF_SCATTER_REQ)
-							 +
-							 (MAX_SCATTER_ENTRIES_PER_REQ
-							  -
-							  1) *
-							 (sizeof
-							  (HIF_SCATTER_ITEM)));
+				kmalloc(sizeof(HIF_SCATTER_REQ) +
+					(MAX_SCATTER_ENTRIES_PER_REQ - 1) *
+					sizeof(HIF_SCATTER_ITEM), GFP_KERNEL);
 
 			if (NULL == pReqPriv->pHifScatterReq) {
 				A_FREE(pReqPriv);
diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c
index 4509aab..025c75e 100644
--- a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c
+++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c
@@ -809,7 +809,7 @@ static int DevSetupVirtualScatterSupport(AR6K_DEVICE * pDev)
 
 	for (i = 0; i < AR6K_SCATTER_REQS; i++) {
 		/* allocate the scatter request, buffer info and the actual virtual buffer itself */
-		pReq = (HIF_SCATTER_REQ *) A_MALLOC(sgreqSize + bufferSize);
+		pReq = kmalloc(sgreqSize + bufferSize, GFP_KERNEL);
 
 		if (NULL == pReq) {
 			status = A_NO_MEMORY;
diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
index e3e8275..0ff36fa 100644
--- a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
+++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
@@ -962,14 +962,13 @@ int GMboxProtocolInstall(AR6K_DEVICE * pDev)
 
 	do {
 
-		pProtocol = A_MALLOC(sizeof(GMBOX_PROTO_HCI_UART));
+		pProtocol = kzalloc(sizeof(GMBOX_PROTO_HCI_UART), GFP_KERNEL);
 
 		if (NULL == pProtocol) {
 			status = A_NO_MEMORY;
 			break;
 		}
 
-		A_MEMZERO(pProtocol, sizeof(*pProtocol));
 		pProtocol->pDev = pDev;
 		INIT_HTC_PACKET_QUEUE(&pProtocol->SendQueue);
 		INIT_HTC_PACKET_QUEUE(&pProtocol->HCIACLRecvBuffers);
diff --git a/drivers/staging/ath6kl/htc2/htc.c b/drivers/staging/ath6kl/htc2/htc.c
index f6debbb..a26f283 100644
--- a/drivers/staging/ath6kl/htc2/htc.c
+++ b/drivers/staging/ath6kl/htc2/htc.c
@@ -107,15 +107,14 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO * pInfo)
 	do {
 
 		/* allocate target memory */
-		if ((target =
-		     (HTC_TARGET *) A_MALLOC(sizeof(HTC_TARGET))) == NULL) {
+		target = kzalloc(sizeof(HTC_TARGET), GFP_KERNEL);
+		if (target == NULL) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 					("Unable to allocate memory\n"));
 			status = A_ERROR;
 			break;
 		}
 
-		A_MEMZERO(target, sizeof(HTC_TARGET));
 		A_MUTEX_INIT(&target->HTCLock);
 		A_MUTEX_INIT(&target->HTCRxLock);
 		A_MUTEX_INIT(&target->HTCTxLock);
@@ -166,7 +165,7 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO * pInfo)
 		}
 		for (i = 0; i < NUM_CONTROL_BUFFERS; i++) {
 			target->HTCControlBuffers[i].Buffer =
-			    A_MALLOC(ctrl_bufsz);
+				kmalloc(ctrl_bufsz, GFP_KERNEL);
 			if (target->HTCControlBuffers[i].Buffer == NULL) {
 				AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 						("Unable to allocate memory\n"));
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c
index b89eef1..c50991f 100644
--- a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c
+++ b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c
@@ -56,13 +56,12 @@ static int SendHCICommand(AR3K_CONFIG_INFO * pConfig, u8 * pBuffer, int Length)
 
 	do {
 
-		pPacket = (HTC_PACKET *) A_MALLOC(sizeof(HTC_PACKET));
+		pPacket = kzalloc(sizeof(HTC_PACKET), GFP_KERNEL);
 		if (NULL == pPacket) {
 			status = A_NO_MEMORY;
 			break;
 		}
 
-		A_MEMZERO(pPacket, sizeof(HTC_PACKET));
 		SET_HTC_PACKET_INFO_TX(pPacket,
 				       NULL,
 				       pBuffer,
@@ -88,7 +87,7 @@ static int RecvHCIEvent(AR3K_CONFIG_INFO * pConfig, u8 * pBuffer, int *pLength)
 
 	do {
 
-		pRecvPacket = (HTC_PACKET *) A_MALLOC(sizeof(HTC_PACKET));
+		pRecvPacket = kzalloc(sizeof(HTC_PACKET), GFP_KERNEL);
 		if (NULL == pRecvPacket) {
 			status = A_NO_MEMORY;
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
@@ -96,8 +95,6 @@ static int RecvHCIEvent(AR3K_CONFIG_INFO * pConfig, u8 * pBuffer, int *pLength)
 			break;
 		}
 
-		A_MEMZERO(pRecvPacket, sizeof(HTC_PACKET));
-
 		SET_HTC_PACKET_INFO_RX_REFILL(pRecvPacket, NULL, pBuffer,
 					      *pLength, HCI_EVENT_TYPE);
 
@@ -138,7 +135,7 @@ int SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO * pConfig,
 		    pConfig->pHCIProps->HeadRoom + pConfig->pHCIProps->TailRoom;
 		length += pConfig->pHCIProps->IOBlockPad;
 
-		pBuffer = (u8 *) A_MALLOC(length);
+		pBuffer = kmalloc(length, GFP_KERNEL);
 		if (NULL == pBuffer) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 					("AR3K Config: Failed to allocate bt buffer \n"));
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c
index fec3039..088931c 100644
--- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c
+++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c
@@ -158,14 +158,14 @@ int PSSendOps(void *arg)
 	/* First verify if the controller is an FPGA or ASIC, so depending on the device type the PS file to be written will be different.
 	 */
 
-	path = (u8 *) A_MALLOC(MAX_FW_PATH_LEN);
+	path = kmalloc(MAX_FW_PATH_LEN, GFP_KERNEL);
 	if (path == NULL) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 				("Malloc failed to allocate %d bytes for path\n",
 				 MAX_FW_PATH_LEN));
 		goto complete;
 	}
-	config_path = (u8 *) A_MALLOC(MAX_FW_PATH_LEN);
+	config_path = kmalloc(MAX_FW_PATH_LEN, GFP_KERNEL);
 	if (config_path == NULL) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 				("Malloc failed to allocate %d bytes for config_path\n",
@@ -220,7 +220,7 @@ int PSSendOps(void *arg)
 		status = 1;
 		goto complete;
 	}
-	buffer = (u8 *) A_MALLOC(firmware->size);
+	buffer = kmalloc(firmware->size, GFP_KERNEL);
 	if (buffer != NULL) {
 		/* Copy the read file to a local Dynamic buffer */
 		memcpy(buffer, firmware->data, firmware->size);
@@ -256,7 +256,7 @@ int PSSendOps(void *arg)
 		if (NULL == firmware || firmware->size == 0) {
 			status = 0;
 		} else {
-			buffer = (u8 *) A_MALLOC(firmware->size);
+			buffer = kmalloc(firmware->size, GFP_KERNEL);
 			if (buffer != NULL) {
 				/* Copy the read file to a local Dynamic buffer */
 				memcpy(buffer, firmware->data, firmware->size);
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
index 68ab904..a016db9 100644
--- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
+++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c
@@ -316,7 +316,7 @@ int AthParseFilesUnified(u8 * srcbuffer, u32 srclen, int FileFormat)
 	}
 	TagCount = 0;
 	ByteCount = 0;
-	Buffer = A_MALLOC(LINE_SIZE_MAX + 1);
+	Buffer = kmalloc(LINE_SIZE_MAX + 1, GFP_KERNEL);
 	if (NULL == Buffer) {
 		return A_ERROR;
 	}
@@ -437,7 +437,7 @@ int AthParseFilesUnified(u8 * srcbuffer, u32 srclen, int FileFormat)
 						PsTagEntry[TagCount].TagLen =
 						    ByteCount;
 						PsTagEntry[TagCount].TagData =
-						    (u8 *) A_MALLOC(ByteCount);
+						 kmalloc(ByteCount, GFP_KERNEL);
 						AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 								(" TAG Length %d  Tag Index %d \n",
 								 PsTagEntry
@@ -689,7 +689,7 @@ int AthDoParsePatch(u8 * patchbuffer, u32 patchlen)
 			return A_ERROR;
 		}
 		RamPatch[Patch_Count].Len = MAX_BYTE_LENGTH;
-		RamPatch[Patch_Count].Data = (u8 *) A_MALLOC(MAX_BYTE_LENGTH);
+		RamPatch[Patch_Count].Data = kmalloc(MAX_BYTE_LENGTH, GFP_KERNEL);
 		Patch_Count++;
 
 		ByteCount = ByteCount - MAX_BYTE_LENGTH;
@@ -697,7 +697,7 @@ int AthDoParsePatch(u8 * patchbuffer, u32 patchlen)
 
 	RamPatch[Patch_Count].Len = (ByteCount & 0xFF);
 	if (ByteCount != 0) {
-		RamPatch[Patch_Count].Data = (u8 *) A_MALLOC(ByteCount);
+		RamPatch[Patch_Count].Data = kmalloc(ByteCount, GFP_KERNEL);
 		Patch_Count++;
 	}
 	count = 0;
@@ -868,7 +868,8 @@ int AthCreateCommandList(PSCmdPacket ** HciPacketList, u32 * numPackets)
 				("Num Cmd Entries %d Size  %d  \r\n",
 				 NumcmdEntry,
 				 (u32) sizeof(PSCmdPacket) * NumcmdEntry));
-		(*HciPacketList) = A_MALLOC(sizeof(PSCmdPacket) * NumcmdEntry);
+		(*HciPacketList) = kmalloc(sizeof(PSCmdPacket) * NumcmdEntry,
+					   GFP_KERNEL);
 		if (NULL == *HciPacketList) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 					("memory allocation failed  \r\n"));
@@ -939,9 +940,9 @@ static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,
 
 		for (i = 0; i < Param1; i++) {
 
-			HCI_PS_Command =
-			    (u8 *) A_MALLOC(RamPatch[i].Len +
-						 HCI_COMMAND_HEADER);
+			HCI_PS_Command = kmalloc(RamPatch[i].Len +
+						 HCI_COMMAND_HEADER,
+						 GFP_KERNEL);
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 					("Allocated Buffer Size %d\n",
 					 RamPatch[i].Len + HCI_COMMAND_HEADER));
@@ -970,14 +971,12 @@ static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,
 
 		Length = 0;
 		i = 0;
-		HCI_PS_Command =
-		    (u8 *) A_MALLOC(Length + HCI_COMMAND_HEADER);
+		HCI_PS_Command = kzalloc(Length+HCI_COMMAND_HEADER, GFP_KERNEL);
 		if (HCI_PS_Command == NULL) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("MALLOC Failed\r\n"));
 			return A_ERROR;
 		}
 
-		memset(HCI_PS_Command, 0, Length + HCI_COMMAND_HEADER);
 		LoadHeader(HCI_PS_Command, Opcode, Length, i);
 		PSPatchPacket[*index].Hcipacket = HCI_PS_Command;
 		PSPatchPacket[*index].packetLen = Length + HCI_COMMAND_HEADER;
@@ -988,13 +987,12 @@ static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,
 	case PS_RESET:
 		Length = 0x06;
 		i = 0;
-		HCI_PS_Command =
-		    (u8 *) A_MALLOC(Length + HCI_COMMAND_HEADER);
+		HCI_PS_Command = kzalloc(Length +
+					 HCI_COMMAND_HEADER, GFP_KERNEL);
 		if (HCI_PS_Command == NULL) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("MALLOC Failed\r\n"));
 			return A_ERROR;
 		}
-		memset(HCI_PS_Command, 0, Length + HCI_COMMAND_HEADER);
 		LoadHeader(HCI_PS_Command, Opcode, Length, i);
 		HCI_PS_Command[7] = 0x00;
 		HCI_PS_Command[Length + HCI_COMMAND_HEADER - 2] =
@@ -1012,17 +1010,15 @@ static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,
 			if (PsTagEntry[i].TagId == 1)
 				BDADDR = true;
 
-			HCI_PS_Command =
-			    (u8 *) A_MALLOC(PsTagEntry[i].TagLen +
-						 HCI_COMMAND_HEADER);
+			HCI_PS_Command = kzalloc(PsTagEntry[i].TagLen +
+						 HCI_COMMAND_HEADER,
+						 GFP_KERNEL);
 			if (HCI_PS_Command == NULL) {
 				AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 						("MALLOC Failed\r\n"));
 				return A_ERROR;
 			}
 
-			memset(HCI_PS_Command, 0,
-			       PsTagEntry[i].TagLen + HCI_COMMAND_HEADER);
 			LoadHeader(HCI_PS_Command, Opcode, PsTagEntry[i].TagLen,
 				   PsTagEntry[i].TagId);
 
@@ -1047,13 +1043,12 @@ static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,
 				("VALUE of CRC:%d At index %d\r\n", Param1,
 				 *index));
 
-		HCI_PS_Command =
-		    (u8 *) A_MALLOC(Length + HCI_COMMAND_HEADER);
+		HCI_PS_Command = kzalloc(Length + HCI_COMMAND_HEADER,
+					 GFP_KERNEL);
 		if (HCI_PS_Command == NULL) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("MALLOC Failed\r\n"));
 			return A_ERROR;
 		}
-		memset(HCI_PS_Command, 0, Length + HCI_COMMAND_HEADER);
 		LoadHeader(HCI_PS_Command, Opcode, Length, Param1);
 
 		PSPatchPacket[*index].Hcipacket = HCI_PS_Command;
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c b/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
index 5dc62bf..2ae7d36 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
@@ -179,12 +179,9 @@ int ar6000_htc_raw_open(AR_SOFTC_T * ar)
 	raw_htc_buffer *buffer;
 	HTC_SERVICE_ID servicepriority;
 	AR_RAW_HTC_T *arRaw = ar->arRawHtc;
-	if (!arRaw) {
-		arRaw = ar->arRawHtc = A_MALLOC(sizeof(AR_RAW_HTC_T));
-		if (arRaw) {
-			A_MEMZERO(arRaw, sizeof(AR_RAW_HTC_T));
-		}
-	}
+	if (!arRaw)
+		arRaw = ar->arRawHtc = kzalloc(sizeof(AR_RAW_HTC_T), GFP_KERNEL);
+
 	A_ASSERT(ar->arHtcTarget != NULL);
 	if (!arRaw) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
diff --git a/drivers/staging/ath6kl/os/linux/ar6k_pal.c b/drivers/staging/ath6kl/os/linux/ar6k_pal.c
index ec55dae..7fea580 100644
--- a/drivers/staging/ath6kl/os/linux/ar6k_pal.c
+++ b/drivers/staging/ath6kl/os/linux/ar6k_pal.c
@@ -419,16 +419,13 @@ int ar6k_setup_hci_pal(void *ar_p)
 
 	do {
 
-		pHciPalInfo =
-		    (ar6k_hci_pal_info_t *)
-		    A_MALLOC(sizeof(ar6k_hci_pal_info_t));
+		pHciPalInfo = kzalloc(sizeof(ar6k_hci_pal_info_t), GFP_KERNEL);
 
 		if (NULL == pHciPalInfo) {
 			status = A_NO_MEMORY;
 			break;
 		}
 
-		A_MEMZERO(pHciPalInfo, sizeof(ar6k_hci_pal_info_t));
 		ar->hcipal_info = pHciPalInfo;
 		pHciPalInfo->ar = ar;
 
diff --git a/drivers/staging/ath6kl/os/linux/hci_bridge.c b/drivers/staging/ath6kl/os/linux/hci_bridge.c
index f813430..f72dec8 100644
--- a/drivers/staging/ath6kl/os/linux/hci_bridge.c
+++ b/drivers/staging/ath6kl/os/linux/hci_bridge.c
@@ -520,16 +520,13 @@ int ar6000_setup_hci(AR_SOFTC_T * ar)
 
 	do {
 
-		pHcidevInfo =
-		    (AR6K_HCI_BRIDGE_INFO *)
-		    A_MALLOC(sizeof(AR6K_HCI_BRIDGE_INFO));
+		pHcidevInfo = kzalloc(sizeof(AR6K_HCI_BRIDGE_INFO), GFP_KERNEL);
 
 		if (NULL == pHcidevInfo) {
 			status = A_NO_MEMORY;
 			break;
 		}
 
-		A_MEMZERO(pHcidevInfo, sizeof(AR6K_HCI_BRIDGE_INFO));
 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
 		g_pHcidevInfo = pHcidevInfo;
 		pHcidevInfo->HCITransHdl = *(HCI_TRANSPORT_MISC_HANDLES *) ar;
@@ -556,8 +553,8 @@ int ar6000_setup_hci(AR_SOFTC_T * ar)
 		}
 
 		pHcidevInfo->pHTCStructAlloc =
-		    (u8 *) A_MALLOC((sizeof(HTC_PACKET)) *
-				    NUM_HTC_PACKET_STRUCTS);
+			kmalloc(sizeof(HTC_PACKET) *
+				NUM_HTC_PACKET_STRUCTS, GFP_KERNEL);
 
 		if (NULL == pHcidevInfo->pHTCStructAlloc) {
 			status = A_NO_MEMORY;
diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c
index b692a29..fcf2ee8 100644
--- a/drivers/staging/ath6kl/os/linux/ioctl.c
+++ b/drivers/staging/ath6kl/os/linux/ioctl.c
@@ -324,7 +324,7 @@ ar6000_ioctl_set_channelParams(struct net_device *dev, struct ifreq *rq)
 	}
 
 	if (cmd.numChannels > 1) {
-		cmdp = A_MALLOC(130);
+		cmdp = kmalloc(130, GFP_KERNEL);
 		if (copy_from_user(cmdp, rq->ifr_data,
 				   sizeof(*cmdp) +
 				   ((cmd.numChannels - 1) * sizeof(u16)))) {
@@ -2104,7 +2104,8 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 		AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
 				("Read Memory (address: 0x%x, length: %d)\n",
 				 address, length));
-		if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
+		buffer = kzalloc(length, GFP_KERNEL);
+		if (buffer != NULL) {
 			A_MEMZERO(buffer, length);
 			ret = BMIReadMemory(hifDevice, address, buffer, length);
 			if (copy_to_user(rq->ifr_data, buffer, length)) {
@@ -2125,7 +2126,8 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 		AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
 				("Write Memory (address: 0x%x, length: %d)\n",
 				 address, length));
-		if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
+		buffer = kzalloc(length, GFP_KERNEL);
+		if (buffer != NULL) {
 			A_MEMZERO(buffer, length);
 			if (copy_from_user(buffer, &userdata[sizeof(address) +
 							     sizeof(length)],
@@ -2291,7 +2293,8 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 		AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
 				("Send Compressed Data (length: %d)\n",
 				 length));
-		if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) {
+		buffer = kzalloc(length, GFP_KERNEL);
+		if (buffer != NULL) {
 			A_MEMZERO(buffer, length);
 			if (copy_from_user
 			    (buffer, &userdata[sizeof(length)], length)) {
@@ -3366,7 +3369,7 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 				ret = -EFAULT;
 			} else {
 				if (setStartScanCmd.numChannels > 1) {
-					cmdp = A_MALLOC(130);
+					cmdp = kmalloc(130, GFP_KERNEL);
 					if (copy_from_user(cmdp, userdata,
 							   sizeof(*cmdp) +
 							   ((setStartScanCmd.
@@ -3848,8 +3851,8 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 					("Change rompatch activation count=%d\n",
 					 rompatch_count));
 			length = sizeof(u32) * rompatch_count;
-			if ((buffer =
-			     (unsigned char *)A_MALLOC(length)) != NULL) {
+			buffer = kzalloc(length, GFP_KERNEL);
+			if (buffer != NULL) {
 				A_MEMZERO(buffer, length);
 				if (copy_from_user
 				    (buffer, &userdata[sizeof(rompatch_count)],
diff --git a/drivers/staging/ath6kl/reorder/rcv_aggr.c b/drivers/staging/ath6kl/reorder/rcv_aggr.c
index 121563d..b1615b4 100644
--- a/drivers/staging/ath6kl/reorder/rcv_aggr.c
+++ b/drivers/staging/ath6kl/reorder/rcv_aggr.c
@@ -55,7 +55,7 @@ void *aggr_init(ALLOC_NETBUFS netbuf_allocator)
 	A_PRINTF("In aggr_init..\n");
 
 	do {
-		p_aggr = A_MALLOC(sizeof(AGGR_INFO));
+		p_aggr = kzalloc(sizeof(AGGR_INFO), GFP_KERNEL);
 		if (!p_aggr) {
 			A_PRINTF("Failed to allocate memory for aggr_node\n");
 			status = A_ERROR;
@@ -63,7 +63,6 @@ void *aggr_init(ALLOC_NETBUFS netbuf_allocator)
 		}
 
 		/* Init timer and data structures */
-		A_MEMZERO(p_aggr, sizeof(AGGR_INFO));
 		p_aggr->aggr_sz = AGGR_SZ_DEFAULT;
 		A_INIT_TIMER(&p_aggr->timer, aggr_timeout, p_aggr);
 		p_aggr->timerScheduled = false;
@@ -215,12 +214,11 @@ void aggr_recv_addba_req_evt(void *cntxt, u8 tid, u16 seq_no, u8 win_sz)
 	/* create these queues, only upon receiving of ADDBA for a
 	 * tid, reducing memory requirement
 	 */
-	rxtid->hold_q = A_MALLOC(HOLD_Q_SZ(win_sz));
+	rxtid->hold_q = kzalloc(HOLD_Q_SZ(win_sz), GFP_KERNEL);
 	if ((rxtid->hold_q == NULL)) {
 		A_PRINTF("Failed to allocate memory, tid = %d\n", tid);
 		A_ASSERT(0);
 	}
-	A_MEMZERO(rxtid->hold_q, HOLD_Q_SZ(win_sz));
 
 	/* Update rxtid for the window sz */
 	rxtid->win_sz = win_sz;
diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c
index 272d4b7..e5358cb 100644
--- a/drivers/staging/ath6kl/wmi/wmi.c
+++ b/drivers/staging/ath6kl/wmi/wmi.c
@@ -279,11 +279,10 @@ void *wmi_init(void *devt)
 
 	A_REGISTER_MODULE_DEBUG_INFO(wmi);
 
-	wmip = A_MALLOC(sizeof(struct wmi_t));
+	wmip = kzalloc(sizeof(struct wmi_t), GFP_KERNEL);
 	if (wmip == NULL) {
 		return (NULL);
 	}
-	A_MEMZERO(wmip, sizeof(struct wmi_t));
 #ifdef THREAD_X
 	INIT_WMI_LOCK(wmip);
 #else
@@ -5620,15 +5619,13 @@ void wmi_scan_indication(struct wmi_t *wmip)
 		return;
 	}
 
-	pAr6kScanIndEvent = A_MALLOC(size);
+	pAr6kScanIndEvent = kzalloc(size, GFP_KERNEL);
 
 	if (NULL == pAr6kScanIndEvent) {
 		IEEE80211_NODE_UNLOCK(nt);
 		return;
 	}
 
-	A_MEMZERO(pAr6kScanIndEvent, size);
-
 	//copy data
 	pAr6kScanIndEvent->ind.StatusType =
 	    Ndis802_11StatusType_BssidScanInfoList;
-- 
1.7.4.15.g7811d

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux