staging: bcm: optimize kmalloc to kzalloc
Use kzalloc rather than kmalloc followed by memset with 0. Found by coccinelle. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
00b6fb2e31
commit
f4a0e6b135
2 changed files with 3 additions and 7 deletions
|
@ -19,12 +19,10 @@ static int bcm_char_open(struct inode *inode, struct file * filp)
|
||||||
PPER_TARANG_DATA pTarang = NULL;
|
PPER_TARANG_DATA pTarang = NULL;
|
||||||
|
|
||||||
Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
Adapter = GET_BCM_ADAPTER(gblpnetdev);
|
||||||
pTarang = (PPER_TARANG_DATA)kmalloc(sizeof(PER_TARANG_DATA),
|
pTarang = kzalloc(sizeof(PER_TARANG_DATA), GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!pTarang)
|
if (!pTarang)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(pTarang, 0, sizeof(PER_TARANG_DATA));
|
|
||||||
pTarang->Adapter = Adapter;
|
pTarang->Adapter = Adapter;
|
||||||
pTarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB);
|
pTarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB);
|
||||||
|
|
||||||
|
|
|
@ -498,13 +498,12 @@ VOID LinkMessage(PMINI_ADAPTER Adapter)
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>");
|
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>");
|
||||||
if(Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup)
|
if(Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup)
|
||||||
{
|
{
|
||||||
pstLinkRequest=kmalloc(sizeof(LINK_REQUEST), GFP_ATOMIC);
|
pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC);
|
||||||
if(!pstLinkRequest)
|
if(!pstLinkRequest)
|
||||||
{
|
{
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!");
|
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(pstLinkRequest,0,sizeof(LINK_REQUEST));
|
|
||||||
//sync up request...
|
//sync up request...
|
||||||
Adapter->LinkStatus = WAIT_FOR_SYNC;// current link status
|
Adapter->LinkStatus = WAIT_FOR_SYNC;// current link status
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For SyncUp...");
|
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For SyncUp...");
|
||||||
|
@ -516,13 +515,12 @@ VOID LinkMessage(PMINI_ADAPTER Adapter)
|
||||||
}
|
}
|
||||||
else if(Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp)
|
else if(Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp)
|
||||||
{
|
{
|
||||||
pstLinkRequest=kmalloc(sizeof(LINK_REQUEST), GFP_ATOMIC);
|
pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC);
|
||||||
if(!pstLinkRequest)
|
if(!pstLinkRequest)
|
||||||
{
|
{
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!");
|
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(pstLinkRequest,0,sizeof(LINK_REQUEST));
|
|
||||||
//LINK_UP_REQUEST
|
//LINK_UP_REQUEST
|
||||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For LinkUp...");
|
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For LinkUp...");
|
||||||
pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD;
|
pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD;
|
||||||
|
|
Loading…
Reference in a new issue