Skip to contentSkip to conversation

staging: rtl8188eu: core: Remove unnecessary conditionals

PATCH In review Thomas Vegas 2 participants 4 messages Jun 22, 2014 – Jun 27, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging: rtl8188eu: core: Remove unnecessary conditionals

The variable 'pxmitbuf' is already set to NULL when entering the function. We can remove the first conditional. When _rtw_queue_empty() returns false, 'pxmitbuf' if not NULL. We can merge the second and third conditional.

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +1 -6
index a113f0f..bb290a3 100644
@@ -1226,9 +1226,7 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
 
 	spin_lock_irqsave(&pfree_queue->lock, irql);
 
-	if (_rtw_queue_empty(pfree_queue) == true) {
-		pxmitbuf = NULL;
-	} else {
+	if (_rtw_queue_empty(pfree_queue) == false) {
 		phead = get_list_head(pfree_queue);
 
 		plist = phead->next;
@@ -1236,9 +1234,6 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
 		pxmitbuf = container_of(plist, struct xmit_buf, list);
 
 		rtw_list_delete(&(pxmitbuf->list));
-	}
-
-	if (pxmitbuf !=  NULL) {
 		pxmitpriv->free_xmit_extbuf_cnt--;
 
 		pxmitbuf->priv_data = NULL;
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 2/3 staging: rtl8188eu: core: Remove unnecessary parentheses

This patch removes unnecessary parentheses around structure member.

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +1 -1
index bb290a3..4b93add 100644
@@ -1233,7 +1233,7 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
 
 		pxmitbuf = container_of(plist, struct xmit_buf, list);
 
-		rtw_list_delete(&(pxmitbuf->list));
+		rtw_list_delete(&pxmitbuf->list);
 		pxmitpriv->free_xmit_extbuf_cnt--;
 
 		pxmitbuf->priv_data = NULL;
Signature · 1 line
1.8.5.5
#2 lore raw

PATCH 3/3 staging: rtl8188eu: core: Remove extraneous blank lines

In reply to Thomas Vegas

Remove extraneous blank lines in rtw_alloc_xmitbuf_ext().

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +0 -9
index 4b93add..101b19f 100644
@@ -1223,31 +1223,22 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv)
 	struct list_head *plist, *phead;
 	struct __queue *pfree_queue = &pxmitpriv->free_xmit_extbuf_queue;
 
-
 	spin_lock_irqsave(&pfree_queue->lock, irql);
-
 	if (_rtw_queue_empty(pfree_queue) == false) {
 		phead = get_list_head(pfree_queue);
-
 		plist = phead->next;
-
 		pxmitbuf = container_of(plist, struct xmit_buf, list);
 
 		rtw_list_delete(&pxmitbuf->list);
 		pxmitpriv->free_xmit_extbuf_cnt--;
-
 		pxmitbuf->priv_data = NULL;
 		/* pxmitbuf->ext_tag = true; */
-
 		if (pxmitbuf->sctx) {
 			DBG_88E("%s pxmitbuf->sctx is not NULL\n", __func__);
 			rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_BUF_ALLOC);
 		}
 	}
-
 	spin_unlock_irqrestore(&pfree_queue->lock, irql);
-
-
 	return pxmitbuf;
 }
 
Signature · 1 line
1.8.5.5
maintainer
#3 lore raw
In reply to Thomas Vegas
Quoted 9 lines · Thomas Vegas

The variable 'pxmitbuf' is already set to NULL when entering the function. We can remove the first conditional. When _rtw_queue_empty() returns false, 'pxmitbuf' if not NULL. We can merge the second and third conditional.

---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Due to changes by others in this file, your patches do not apply anymore, sorry.

greg k-h