static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new,
                                        int (*compare)(struct sk_buff *a, struct sk_buff *b))
 {
-       struct sk_buff *pos, *insert = (struct sk_buff *)head;
+       struct sk_buff *pos, *insert = NULL;
 
        skb_queue_reverse_walk(head, pos) {
                const struct can_rx_offload_cb *cb_pos, *cb_new;
                insert = pos;
                break;
        }
-
-       __skb_queue_after(head, insert, new);
+       if (!insert)
+               __skb_queue_head(head, new);
+       else
+               __skb_queue_after(head, insert, new);
 }
 
 static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b)