Merge drm/drm-next into drm-misc-next
[linux-2.6-microblaze.git] / drivers / gpu / drm / nouveau / nouveau_bo.c
index 50ee9d7..56dcd25 100644 (file)
@@ -325,8 +325,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
                            (!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
                                continue;
 
-                       if (pi < 0)
-                               pi = i;
+                       /* pick the last one as it will be smallest. */
+                       pi = i;
+
                        /* Stop once the buffer is larger than the current page size. */
                        if (*size >= 1ULL << vmm->page[i].shift)
                                break;