title: list_empty function kernel linked list
body: <p><code>list_empty()</code> function is defined in <code>./include/linux/list.h</code> and its definition is</p>
  
  <pre><code>static inline int list_empty(const struct list_head *head)
  {
      return head-&gt;next == head;
  }
  </code></pre>
  
  <p><code>list_head</code> data structure is defined as</p>
  
  <pre><code>struct list_head {
       struct list_head *next, *prev;
  };
  </code></pre>
  
  <p>What I do not understand is why this implementation in kernel checks for <code>head-&gt;next == head</code> and not for <code>head-&gt;next == NULL</code> &amp;&amp; <code>head-&gt;prev == NULL</code>.</p>