staging: vt6656: nsDMA_tx_packet Move pContext later.
authorMalcolm Priestley <tvboxspy@gmail.com>
Thu, 15 May 2014 21:49:10 +0000 (22:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 22:02:18 +0000 (15:02 -0700)
call s_vGetFreeContext later in function skiping large
chunk of code.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/rxtx.c

index 03d5339191b6f252b4faff279ddcae347af2c3e4..57eb5025ae276981df4da2bfadb99b8779556e16 100644 (file)
@@ -2172,14 +2172,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
         }
     }
 
-       pContext = s_vGetFreeContext(pDevice);
-
-    if (pContext == NULL) {
-        DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n");
-        dev_kfree_skb_irq(skb);
-        return STATUS_RESOURCES;
-    }
-
        memcpy(&pDevice->sTxEthHeader, skb->data, ETH_HLEN);
 
 //mike add:station mode check eapol-key challenge--->
@@ -2402,7 +2394,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
 
             if (pTransmitKey == NULL) {
                 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n");
-               pContext->bBoolInUse = false;
                 dev_kfree_skb_irq(skb);
                 pStats->tx_dropped++;
                 return STATUS_FAILURE;
@@ -2410,6 +2401,13 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, struct sk_buff *skb)
         }
     }
 
+       pContext = s_vGetFreeContext(pDevice);
+       if (!pContext) {
+               DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG" pContext == NULL\n");
+               dev_kfree_skb_irq(skb);
+               return STATUS_RESOURCES;
+       }
+
        pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
 
     fConvertedPacket = s_bPacketToWirelessUsb(pDevice, byPktType,