Skip to contentSkip to conversation

staging: rtl8188eu: os_dep: Use list_entry() rather than container_of()

PATCH In review Janani Ravichandran 2 participants 2 messages Feb 28, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8188eu: os_dep: Use list_entry() rather than container_of()

Use list_entry() rather than container_of() with linked list nodes. Semantic patch used:

@a exists@
identifier var;
struct list_head *ptr;
@@

var =
- container_of
+ list_entry
(ptr, ...);

---
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +1 -1
index 1593e28..d950c4f 100644
@@ -178,7 +178,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
 
 	/* free sta asoc_queue */
 	while (phead != plist) {
-		psta = container_of(plist, struct sta_info, asoc_list);
+		psta = list_entry(plist, struct sta_info, asoc_list);
 
 		plist = plist->next;
 
Signature · 1 line
2.5.0
#1 lore raw
Quoted 23 lines · Janani Ravichandran

Use list_entry() rather than container_of() with linked list nodes. Semantic patch used:

@a exists@
identifier var;
struct list_head *ptr;
@@

var =
- container_of
+ list_entry
(ptr, ...);

---
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0 -0
index 1593e28..d950c4f 100644

drivers/staging/rtl8188eu/os_dep/xmit_linux.c static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb) · line 180

Quoted 3 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0 -0
@@ -178,7 +178,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
 
 	/* free sta asoc_queue */
 	while (phead != plist) {

This may be another hidden list_for_each. This time the list doesn't become empty.

julia

Quoted 15 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +1 -1
-		psta = container_of(plist, struct sta_info, asoc_list);
+		psta = list_entry(plist, struct sta_info, asoc_list);
 
 		plist = plist->next;
 
Signature · 8 lines
2.5.0

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160228185658.GA5218%40janani-Inspiron-3521.
For more options, visit https://groups.google.com/d/optout.