staging: rtl8188eu: use safe iterator in rtl8188eu_xmitframe_complete()
[linux-2.6-microblaze.git] / drivers / staging / rtl8188eu / hal / rtl8188eu_xmit.c
index 2866283..19055a1 100644 (file)
@@ -414,6 +414,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,
                                  struct xmit_priv *pxmitpriv)
 {
        struct xmit_frame *pxmitframe = NULL;
+       struct xmit_frame *n;
        struct xmit_frame *pfirstframe = NULL;
        struct xmit_buf *pxmitbuf;
 
@@ -422,7 +423,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,
        struct sta_info *psta = NULL;
        struct tx_servq *ptxservq = NULL;
 
-       struct list_head *xmitframe_plist = NULL, *xmitframe_phead = NULL;
+       struct list_head *xmitframe_phead = NULL;
 
        u32 pbuf;       /*  next pkt address */
        u32 pbuf_tail;  /*  last pkt tail */
@@ -507,12 +508,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt,
        spin_lock_bh(&pxmitpriv->lock);
 
        xmitframe_phead = get_list_head(&ptxservq->sta_pending);
-       xmitframe_plist = xmitframe_phead->next;
-
-       while (xmitframe_phead != xmitframe_plist) {
-               pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
-               xmitframe_plist = xmitframe_plist->next;
-
+       list_for_each_entry_safe(pxmitframe, n, xmitframe_phead, list) {
                pxmitframe->agg_num = 0; /*  not first frame of aggregation */
                pxmitframe->pkt_offset = 0; /*  not first frame of aggregation, no need to reserve offset */