mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
[linux-block.git] / mm / percpu.c
index 26d8cd2ca3230956f3a018790fabeaf66bc7f599..841bb93aaae6862b510487ce3aadbbb93dda1260 100644 (file)
@@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void)
         * other accessor is the free path which only returns area back to the
         * allocator not touching the populated bitmap.
         */
-       while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) {
-               chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot],
-                                        struct pcpu_chunk, list);
+       while ((chunk = list_first_entry_or_null(
+                       &pcpu_chunk_lists[pcpu_to_depopulate_slot],
+                       struct pcpu_chunk, list))) {
                WARN_ON(chunk->immutable);
 
                /*