sctp: use list_* in sctp_list_dequeue
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Fri, 1 Apr 2016 17:30:32 +0000 (14:30 -0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Apr 2016 19:44:08 +0000 (15:44 -0400)
Use list_* helpers in sctp_list_dequeue, more readable.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/sctp.h

index 65521cfdcadeee35d61f280165a387cc2164ab6d..03fb33efcae21d54192204629ff4ced2e36e7d4d 100644 (file)
@@ -386,11 +386,9 @@ static inline struct list_head *sctp_list_dequeue(struct list_head *list)
 {
        struct list_head *result = NULL;
 
-       if (list->next != list) {
+       if (!list_empty(list)) {
                result = list->next;
-               list->next = result->next;
-               list->next->prev = list;
-               INIT_LIST_HEAD(result);
+               list_del_init(result);
        }
        return result;
 }