Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 895b1fb8 authored by Kevin McKinney's avatar Kevin McKinney Committed by Greg Kroah-Hartman
Browse files

Staging: bcm: Clean up function CopyBufferToControlPacket in Misc.c



This patch cleans up the code in function
CopyBufferToControlPacket. Several things are
being done here: (1) remove the null
initialization from variable cntrl_buff, (2)
reverse the if statement to check if cntrl_buff
is null; if so, then write debug statement and
return -ENOMEM error code, and (3) indent the
code properly.

Signed-off-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7af14134
Loading
Loading
Loading
Loading
+56 −54
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ int CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, void *ioBuffer)
{
	struct bcm_leader *pLeader = NULL;
	int Status = 0;
	unsigned char *ctrl_buff = NULL;
	unsigned char *ctrl_buff;
	unsigned int pktlen = 0;
	struct bcm_link_request *pLinkReq = NULL;
	PUCHAR pucAddIndication = NULL;
@@ -325,9 +325,14 @@ int CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, void *ioBuffer)
	pktlen = pLeader->PLength;
	ctrl_buff = (char *)Adapter->txctlpacket[atomic_read(&Adapter->index_wr_txcntrlpkt)%MAX_CNTRL_PKTS];

	if (!ctrl_buff) {
		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed");
		return -ENOMEM;
	}

	BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Control packet to be taken =%d and address is =%pincoming address is =%p and packet len=%x",
			atomic_read(&Adapter->index_wr_txcntrlpkt), ctrl_buff, ioBuffer, pktlen);
	if (ctrl_buff) {

	if (pLeader) {
		if ((pLeader->Status == 0x80) ||
			(pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ)) {
@@ -379,10 +384,7 @@ int CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, void *ioBuffer)
	BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Calling transmit_packets");
	atomic_set(&Adapter->TxPktAvail, 1);
	wake_up(&Adapter->tx_packet_wait_queue);
	} else {
		Status = -ENOMEM;
		BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed");
	}

	BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "<====");
	return Status;
}